Even in Newtonian mechanics, light was expected to be affected by gravitational fields. While there is no force, no force is necessary to accelerate an object with no mass. The idea in Newtonian mechanics would be to take ##mg = ma## and taking the limit ##m\to 0## would still give ##a = g##.

Now, Newtonian mechanics does not describe the bending of light appropriately and quantitatively, you need general relativity for that. In GR, mass is not the source of gravity and gravity is not even a force, so you should not have any expectation of gravity based on masses.