Power dissipation = (voltage across the component)² / (resistance of the component)
Since the resistance is in the denominator of the fraction in this formula for the
quantity of power dissipated, you can see that when the supply voltage is constant,
the smaller resistance dissipates more power.
So the 40w lamp has higher resistance than the 60w bulb.