Assuming the conventional Casimir setting with two thick parallel perfectly conducting plates of large extent with a homogeneous and isotropic medium between them, we discuss the physical meaning of the electromagnetic field energy W disp when the intervening medium is weakly dispersive but nondissipative. The presence of dispersion means that the energy density contains terms of the form d[ωε(ω)]/dω and d[ωµ(ω)]/dω. We find that, as W disp refers thermodynamically to a non-closed physical system, it is not to be identified with the internal thermodynamic energy U following from the free energy F , or the electromagnetic energy W , when the last-mentioned quantities are calculated without such dispersive derivatives. To arrive at this conclusion, we adopt a model in which the system is a capacitor, linked to an external self-inductance L such that stationary oscillations become possible. Therewith the model system becomes a non-closed one. As an introductory step, we review the meaning of the nondispersive energies, F, U, and W . As a final topic, we consider an anomaly connected with local surface divergences encountered in Casimir energy calculations for higher spacetime dimensions, D > 4, and discuss briefly its dispersive generalization. This kind of application is essentially a generalization of the treatment of Alnes et al. [J. Phys. A: Math. Theor. 40, F315 (2007)] to the case of a medium-filled cavity between two hyperplanes.