When manufacturers say 40 watt LED is comparable to 300 watt incandescent, they’re really saying the Lumen output is comparable. 40 watt LED will output same light (Lumens) as the 300 watt incandescent. Then it becomes a matter of how that light is distributed, but that’s a different conversation.
A 40 watt LED or incandescent can’t generate more than 40 watts of heat.
Seeing how 98% of an incandescent’s energy goes into heat, and 85%-90% of an LEDs goes into heat, if they really are both drawing 40 watts, the heat generated is within a 8%-13% of each other.
Again, distribution. It may be the heat of the LED is generated, and concentrated at, the transformer; whereas an incandescent is more distributed around the bulb, but...
Watts is watts.