In classical electrodynamics, the work of a magnetic dipole (current loop) done by external magnetic field is related to electromagnetic induction, and there is generally no potential energy conceptionally. In quantum mechanics, a magnetic dipole (electron spin) does have potential energy in an external magnetic field. We discuss the subtle differences between classical and quantum situations, and try to understand their relation in a natural way.
Chun LIU (Tue,) studied this question.