Still, a photon has no mass to contribute to E=mc^2. A photon exhibits mass-like particle behavior, but has no inertia, no mass.
Actually, things like light turning into matter and vice-versa happen constantly. E=mc^2 is the equivalency between matter and energy.
For instance, when an atom is split, and the mass of its remnants is tallied, there is some mass missing. That mass has become energy (mostly kinetic, some radiation). The amount of that energy is E=Äm*c^2.
Likewise, a photon of light of a high enough frequency (frequency and energy having a direct linear relationship) can be slowed enough to produce a pair of oppositely charged particles, an electron and a positron. This is called "pair creation"; the reverse is "pair annihilation". Again, the mass of these particles is derived from the amount of energy used to create them. Solving for m, m=ÄE/c^2.