You can think about it as light loosing energy as it climbs out of the strong gravitational field conditions that prevailed in the early history of the universe, and 'escaping' into the low gravitational field conditions of the present universe. It is doing 'work' against the changing gravitational field of the universe during its journey. This causes it to loose energy, just as light emitted from the surface of the Earth into space looses energy and becomes redshifted.