Do photons gain mass when they travel through glass? Please correct me if I'm wrong, but I believe that photons slow down when travelling through glass. Does this mean they gain mass? Otherwise, what happens to extra kinetic energy?
I understand now that the apparent slowing down is due to electron interactions, does the glass gain weight due to light travelling through it?
 A: I'd like to add to Kostya's Excellent Answer and also Marek's.
Kostya is actually describing a quantum superposition of free photon and excited matter states. Often in this scenario, the refractive index is described as arising from the repeated absorption and re-emission of the vacuum photons by the atoms/molecules of the medium. This is a good first picture, but it's more accurate to describe the situation as the quantum superposition just mentioned. The so called quasiparticle is this superposition, which is the energy eigenstate in the presence of the medium, i.e. the energy eigenstate of the electromagnetic field coupled to the excited matter states. The eigenstate (quasiparticle) is called various things depending on the exact nature of the interaction: polariton, plasmon, exciton, and so forth but, in principle, their essential nature as a quantum superposition of photon and raised matter states is exactly the same in each case.
You can calculate the rest mass of the quasiparticle as well. This is a way of expressing where the energy has "gone to" in the medium: we can move in the frame at rest relative to the quasiparticle and the disturbance has a nonzero energy $m_0\,c^2$ in this frame, representing energy stored in the exited matter states of the medium.
Let's calculate the rest mass of the quasiparticle from $E^2=p^2\,c^2 + m_0^2\,c^4$ and $p = \gamma\,m_0\,v$ with $v = c/n$, with, as usual, $\gamma = \frac{1}{\sqrt{1-{v^2}/{c^2}}}$ is the Lorentz factor. Let's  do this from the frame at rest relative to the medium (although, of course, $m_0$ is Lorentz invariant, so we can do a corresponding calculation from any frame). Thus:
$$E^2 = p^2\,c^2 + m_0^2\,c^4=m_0^2\,c^4\left(\frac{1}{n^2\,\left(1-\frac{1}{n^2}\right)}+1\right)=m_0^2\,c^4\frac{n^2}{n^2-1}$$
or
$$m_0 = \frac{E}{c^2}\sqrt{1-\frac{1}{n^2}}$$
For $n=1.5$ (common glasses like window panes or N-BK7 - microscope slide glass) at $\lambda = 500\rm\,nm$, we get, from $E=h\,c/\lambda$, $m_0=3.3\times 10^{-36}{\rm kg}$ or about 3.6 millionths of an electron mass.
A: Dear Dan, this is actually a very simple question. The phase velocity or group velocity of a photon may be smaller. But the energy of a single photon is always
$$E=hf$$
where $h$ is Planck's constant and $f$ is the frequency. This is true for quanta in any material - and not only for photons, in fact. It's also true for gravitons, electrons, muons, or any other particles. This relationship between energy and frequency of the wave associated with the particle is totally universal - and follows from the fact that energy (the Hamiltonian) generates the evolution in time, i.e. is given by the frequency for all periodic wave functions. 
The frequency of a photon doesn't change anywhere - it must still make the same number of "periods" per second, wherever you look - imagine that you emit a packet that has 500 maxima and 500 minima of a wave, so the same number will be seen everywhere.
So the energy of each photon remains constant as it moves through any environment. Of course, when it's absorbed, it gives its energy (or its part) to another particle.
A: Transmission of light through glass has nothing to do with electron excitation and that is precisely why glass is transparent. In fact, incoming electromagnetic wave polarizes the medium that re-emits the radiation. Theoretically it could be re-emitted in any direction but it can be shown that different wavelets (small parts of the wave) will interfere positively only in the initial direction of light. How difficult it is to polarize a certain medium is characterized by its polarizability which is directly linked to the refractive index.
Now, to the question about the mass of the photon.
Photon momentum is defined as $\textbf{p}=\hbar\textbf{k}$. It can be shown that momenta of incident(i) and transmitted(t) photons are related as $$n_{ti}=\frac{p_t}{p_i}$$ where n is the refractive index. This means that for $n_{ti}>1$, $p_t>p_i$ so the momentum of the photon actually increases which can be attributed to an increase of the photon's effective mass (see F.R. Tangherlini, "On Snell's law and the Gravitational Deflection of Light", Am. J. Phys. 36, 1001 (1968). 
Edit: The argument whether a photon's momentum in medium is $n$ times smaller of $n$ times larger is known as Abraham–Minkowski controversy and there are strong evidences for both definitions. 
A: Fundamental approach
Marek's answer is summarised shortly as "no". It is based on the most "fundamental" concepts of physics -- you got fundamental quantum particles -- photons, electrons and some others. And these particles interact with each other producing all the world around us. The properties of the particles, like their mass, charge, e.t.c. doesn't change whatever you do with them. And, therefore, the mass of the photon is always zero.  
This appoach is very intuitive and of course the answer is correct... 
But one can look at the same problem from different perspective, obtaining a different answer:
Quasiparticles approach
Those fundamental particles are just excitations of the vacuum -- the universal medium for everything around us. We like to talk about particles, because they are "free" -- they are flying freely in the vacuum, rarely interacting with each other.
Now instead of vacuum we consider another "not so universal" medium -- a glass. Like everything else the glass is made of the mentioned fundamental particles.  It turns out that one wouldn't want to talk about the fundamental photon inside a glass -- it always interacting with stuff in the matter: it scatters, got absorbed, got re-emitted e.t.c. In other words it is not "free". It is much easier to consider a quasiparticle, which is "nearly a photon". A quasiparticle is an excitation of the glassy medium. And it behaves like it is "free" in the glass -- it is flying freely in the glass, rarely interacting with other quasiparticles.
From that point of view the answer to the question is "yes" -- inside the glass the quasiparticle called "photon" has some mass, while in the vacuum the fundamental particle called "photon" hasn't.
This  second point of view is much more elaborate and takes more effort to understand, but I think that it is more "flexible" and allows you to understand such things as renormalization, effective field theories, quarks and hadron structure and QCD, thermal field theory, e.t.c.
After all, the thing we now call "the fundamental vacuum" can be just "a glass" made of something more fundamental. 
A: Edit: thanks to all the commentators. Before I mixed together both scattering and absorption of light. I tried to update the answer to more accurately describe what is actually going on down there.
Note: I will only consider interaction with molecules of the material here. More advanced stuff like interaction with the lattice of crystals or interaction with free electrons in metals would need a separate discussion.

What happens is that when photon enters the matter it has a non-zero probability to scatter on atoms of the material. In QED (quantum electrodynamics) this process is realized by summing over all possible ways the photon can interact with electrons of the material. Simplest way is that the photon is absorbed by electron, thereby increasing its energy (but this is not an excitation to a precise energetic level; any energy will do) and after a little while electron emits a different photon. As correctly pointed out by Tobias, if there are more photons with the same energy and momentum nearby, the emitted photon will tend to have same characteristics. This is because photons are bosons and bosons like to occupy same states.
Now, all of these processes contribute to the final scattering amplitude. This is a complex number describing both the apparent slow-down of the photons on the matter and also absorption of light in the matter. Its value depends on the precise way molecule looks, what energy levels do electrons occupy and so on. In any case, you can (at least in principle) reduce all that complexity of single atom into a number that tells you the index of refraction and the coefficient of absorption. Note that this number will also depend on the energy of the incoming photon, giving dispersion.
If we want to find the actual time it will take photon (note that here the word photon is used liberally as it might get absorbed and re-emitted) to travel through the material, we are again encouraged to sum over all the possible trajectories and this means over all the possible scatterings on all of the atoms. One possible trajectory is that photon doesn't interact with anything. This is a dominant one that would be correct in vacuum. But now there is also a possibility that photon will scatter on some atoms (usually just one of them though, because the scattering probability is small) and this will modify the final amplitude. If there is no absorption, the only effect will be that it will "take the photon longer time to travel through material". If there is also absorption the probability of the photon to pass through the material will lower.
Of course, quantum theory is just probabilistic in nature and what this means is that if you let lots of photons go through the material then they will, in general, take some scattering on the atoms. So it can be said (and it is great deal correct) that matter's electrons "trap" the incoming light, making it propagate slower.
A: The photon never slows down, as the particle goes through the medium of glass it is absorbed by the nearby electrons. The absorption and re-emitting of the photon takes time, we interpreted that as the photon slowing down. The photon is always going the same speed and always has zero mass. 
