The discussions here tend to follow something of a meandering path and contain their own links to other discussions that are similarly meandering. Those who don't want to wade through the interminable links may benifit from something of an executive summary.
for a particle in a magnetic field, we have to consider two cases:
1. the particle has no intrinsic magnetic moment
2. the particle has an intrinsic magnetic moment
For these situations:
for 1. the B field does no work since the force is always perpendicular to the motion - but, recalling Newton's laws - it is the
net force that does the work. The B-force can contribute to the net force in a way similar to the "normal force" in sliding-block problems.
for 2. the B field can do work as it interacts with the magnetic dipole. This is the principle behind the Stern-Gerlach experiment for eg.
Much of the debate revolves around what is "really" happening in #2. So let's be clear:
#2 is a quantum mechanical effect.
It is possible to model it
as if there were an uneven charge distribution that acts as some sort of current and, thereby, obtain some hand-wavy link to pre-existing understandings of classical electromagnetism. That's not really a useful way to think about it, however, it is common in introductory e-mag courses.
Better to think of QM as a superset of the classical - seeking to understand QM in terms of classical physics will only get you tangled up.
Introductory physics texts are usually only concerned about #1 so they tend to leave off the qualification that the statement only applies to charged particles in a magnetic field. You'll notice that the same texts tend to follow the statement with examples involving only uniform magnetic fields - where there is no magnetic dipole interaction.
Students from early on are taught two different models of magnetism - in one they are encouraged to think of materials as consisting of lots of tiny magnets which are all lined up in permanent magnets and in the other they are encouraged to think in terms of tiny current loops. We get this sort of question as students struggle to find links between the models.
Further reading:
http://www.phys.ufl.edu/courses/phy2049/f07/lectures/2049_ch28B.pdf
... most of the discussions are summed up in this lecture: slide 17, in particular.
https://www.physicsforums.com/showthread.php?t=31239
... specifically posts 4 and 18.