Since the universe is expanding, photons emitted by distant stars are red-shifted, having their wavelengths stretched out. But, since the energy of a photon is dependent on the inverse of its wavelength, doesn't that mean that the expansion of the universe is causing photons to lose energy? How does this not violate the conservation of energy? A similar question deals with the admittedly minuscule but still present changes in potential energy between, for example, seperated charges or masses when the space between them expands. I know the effect is likely not measurable, but energy can't just be appearing, right?