I just watched a web video about white dwarf stars. It mentions that the star’s electrons flow among the degenerate matter. Since most of the electrons can’t be in the lowest state, due to Pauli’s exclusion principle, they get bumped to higher states and replace the radiation pressure that disappeared when fusion stopped. But where did the energy to boost the electrons to distinct states (modulo spin) come from? What lost energy to make up for it?
The energy comes from whatever force pulled the electrons into such a dense volume in the first place--in this case, gravity.
When the star is 'normal sized', like the Sun, electron degeneracy produces a small amount of pressure. As the star makes its way along the path to a white dwarf, the electron degeneracy pressure rises as it gets smaller. While the total pressure is less than the gravitational force, the star shrinks, trading decreasing gravitational energy* for increasing pressure energy.
*Gravitational energy is negative. Decreasing gravitational energy means that this energy becomes the negative of an increasingly large amount of energy.
This pressure energy includes the thermal pressure energy at some stages of evolution, but when degeneracy is reached, that means that the pressure energy is predominantly Pauli exclusion principle based.
The answer is that you have to do work on the gas to compress it enough for it to become degenerate. The work done is $\int P\ dV$ and this work is used to increase the internal (kinetic) energy of the electrons.
In a white dwarf star, the work is done by the gravitational force. As the core of a proto-white dwarf shrinks then about half the gravitational potential energy that is released is lost as radiation or convection to its surroundings and about half goes into raising the internal energy of the gas.