The circuit consumes energy to build the magnetic field. That means building up current through an inductor. If there's resistance in series, some energy is dissipated continuously. Superconductors are free of this harm.
Breaking the current of an inductor removes the magnetic field. The field energy can be returned to the current supply if there's properly constructed circuit for it. In practical circuits some dissipation occurs also in this phase because parts have resistance.
Simply opening a mechanical switch to break the current in the inductor dissipates 100% of the magnetic field energy in an arc which occurs over the switch except in case there's a circuit which directs the inductive kickback pulse back to the source or to some other useful place. I guess you should read this:
https://electronics.stackexchange.com/questions/282053/how-does-the-inductor-really-induce-voltage/282073?r=SearchResults&s=5|19.9734#282073
and learn something about induction also from other physics and electricity teaching materials.
The text does not take into the account energy loss as radiated electromagnetic waves. They appear and take something away to the space if the increasing or decreasing rate of the current in field buildup or collapse are high enough in relative to the mechanical dimensions of the structure and there's no attempt to prevent the radiation with geometric forms.