But there is another layer below but I am less sure about that, it may be (slightly) wrong. In quantum electro dynamics photon take, figuratively spoken, all possible paths from source to detector, also paths that require going slower and faster than the speed of light. All those possible paths interfere with each other and the net result is that the photon seems to move with the speed of light with very high probability. But really take that with a large grain of salt.
That's a story we tell kids who ask too many awkward questions. If it were true we would see sharp changes in the observed speed of light at wavelengths depending on the absorption spectrum of the material in question.
My understanding is that the real answer involves photons gaining inertia via coupling with particles in the material they are passing through (cf. Higgs) ... but I'm probably mangling that explanation horribly.
Uh, we do. The imaginary portion of the index of refraction near a resonance generally looks roughly like a gaussian, and the real portion does have jumps that look a bit like tanh.
So its speed of light in quantum foam?