For a system with a fixed number of electrons, the total optical sum is a constant, independent of many-body interactions, of impurity scattering and of temperature. For a single band in a metal, such a sum rule is no longer independent of the interactions or temperature, when the dispersion and/or finite bandwidth is accounted for. We adopt such a model, with electrons coupled to a single Einstein oscillator of frequency ωE, and study the optical spectral weight. The optical sum depends on both the strength of the coupling and on the characteristic phonon frequency, ωE. A hardening of ωE, due, for example, to a phase transition, leads to electron undressing and translates into a decrease in the electron kinetic energy and an increase in the total optical sum, as observed in recent experiments in the cuprate superconductors.