Energy stored in an inductor $=\frac{1}{2} LI ^{2}$
This energy is actually stored in the magnetic field generated by the current flowing through the inductor.
In a pure inductor, the energy is stored without loss, and is returned to the rest of the circuit when the current through the inductor is ramped down, and its associated magnetic field collapses.
$W =\frac{1}{2} LI ^{2} $
$=\frac{\mu_{0} N ^{2} A }{2 I }\left(\frac{ Bl }{\mu_{0} N }\right)^{2} $
$=\frac{ B ^{2}}{2 \mu_{0}} lA $
$ \therefore $ Energy stored per unit volume $=\frac{ B ^{2}}{2 \mu_{0}} $