# Energy of a magnetic dipole in an external B field

As in Feynman's lecture on physics vol 2, he showed that the "true energy" of a magnetic dipole(current loop) in an external B field is m*B, not -m*B. Basically the argument is if you want to pull a current loop from infinity to the final position, you must do extra work to keep the current in the loop constant. If you take this energy into account, the total energy will be m*B.
But in statistical mechanics of magnetization, if we use U=m*B instead of -m*B, we will get the opposite results,for example, we will get that the higher the temperature is, the easier to magnetize a material, which is obviously wrong.
How should I explain this?