This question is similar to "How can a photon have energy when it has no mass?"
The momentum of a photon is equal to its energy divided by c.
If a photon had any rest mass, it would require infinite energy to accelerate it to the speed of light. Therefore, the rest mass of a photon must be zero.
Of course, it's possible to work out a property of a photon with the dimension of mass by dividing its momentum by c (or its energy by c^2). This is called the "relativistic mass" of the photon and has a non-zero value.