Mass is really just tightly bound energy, they're the same thing. We don't typically see massless things have a gravitational effect for the same reason you don't notice the things around you gravitationally attracted to you. The earth is so much bigger than you, and mass is extremely energy dense (e=mc^2 is the conversion rate between rest mass and energy. c^2 is a huge scaler. It's actually a shortened infinite series that adds up a bunch of velocity terms, so we call that rest mass cause at rest the velocity terms are all 0) and so massless things have much less of an effect. Also massless things have to always move at the speed of light, so they're not around long to actually have an effect.
There's actually a fun thought experiment about this, highlighted in this link: https://physicsdetective.com/the-mystery-of-mass-is-a-myth/
I haven't read the whole article (I was just wanting this one example) but the section labeled "The photon in the mirror-box" has a description of it. Effectively the idea of mass and energy are the same, like particle and wave.