Light has no weight, therefore light can travel through the universe without gravitational constraints. Now why can black holes attract light, as observed? That's just a deformation of space, in the same way that a massive celestial body make light turn. In fact, black holes affect the propagation path of light rather than the light itself.