A Quora question asks:Given that light is massless, and that all massless particles travel at the speed of light, it should follow that in a medium with a refractive index >1 (where light slows down), it acquires mass and experiences time. Why is this not the case?
It is not always true that “light is massless”. For example light trapped in a reflective container contributes to the rest mass of the system consisting of the container and its contents.
It is not obvious that massless particles always travel at the speed of light (but unless they are doing so they have zero momentum and so don’t change the momentum of things they collide with).
The speed of a photon is always equal to the vacuum speed of light in between its interactions with matter, but the probability of detecting a photon travelling through a medium is calculated from a sum of probability amplitudes associated with all possible paths including those which involve interacting with atoms in the medium. Since many of these paths are indirect, their lengths are greater than the straight line distance and so the average time taken corresponds to a speed less than that of light in a vacuum.
[Some answers have suggested also delays due to absorption and re-emission but if these really happened with random delays they would destroy the coherence and so in a perfectly clear medium the interactions are all effectively just instantaneous reflections off bound electrons (with minimal energy transfer due to the masses of the nuclei).]
One might be tempted to look for a way of describing the result in terms of effective photons with mass; but we can’t expect any proper Lorentz covariant theory of such particles since the medium is only stationary in a particular inertial frame, and in relatively moving frames it appears contracted which changes the density and so the index of refraction (in a direction dependent way).