Magnetic fields do not do work on moving charges, but they can exert torque on magnetic moments and produce net translational force in inhomogeneous fields. In the case of an electromagnet lifting a car, the work is performed by the power source driving the electromagnet, not the magnetic field itself. The displacement of the car towards the electromagnet creates a force component that requires energy from the power source. Permanent magnets can also lift objects, doing work by converting energy into kinetic energy as they attract ferrous materials. This energy is not depleted; it can be returned when the object is moved away from the magnet.