I have the following general conceptual concern.
Think of a thin conducting loop of radius $R$ placed in the $x$-$y$-plane at $z=0$. There is a homogeneous current density $\vec{j}$ running through this loop:
$$\vec{j}(\vec{r})=|j|\delta(z)\delta(x^2+y^2-R^2)\frac{-y\,\vec{e}_x+x\,\vec{e}_y}{\sqrt{x^2+y^2}}$$
Per definition, this loop has a magnetic moment of:
$$\vec{m}=\frac{1}{2}\int d^3r\,\left(\vec{r}\times\vec{j}(\vec{r})\right)=-|j|\pi R\,\vec{e}_z$$
Now, imagine there appears a magnetic field that can be locally described as:
$$\vec{B}=b_0 z\,\vec{e}_z$$
If we ask ourselves what the electromagnetic force on the loop will be, we have two equations that can give us the answer. (The two answers should be the same, but curiously they are not). First equation is the straightforward definition of Lorentz force:
$$\vec{F}_1=\int d^3r\,\left(\vec{j}(\vec{r})\times\vec{B}\right)$$
And the second equation makes use of the magnetic moment (and is also exact for this simple magnetic field):
$$\vec{F}_2=\nabla(\vec{m}\cdot\vec{B})$$
It is now straightforward to see that the first force has the structure $\vec{F}_1=A\vec{e}_x+B\vec{e}_y$, while the second force must clearly look like $\vec{F}_2=C\vec{e}_z\neq 0$ (evidently non-zero due to inhomogenous $\vec{B}$ field). My question is - what went wrong and how to fix this?