Suppose I have two identical current loops superimposed upon one another, but with their currents in opposite directions. The coefficient of coupling $K=1$, and therefore the mutual inductance $M =\sqrt {L_1L_2} = L$, giving the total magnetic energy as
$$E_m = 1/2(L_1i_1^2 + L_1i_1^2) + Mi_1i_2 = 2Li^2$$
But since the total magnetic field is zero, the total magnetic energy is zero, so where has the apparent excess energy come from?