newby9000:
Did the bulb "magically" change its resistance?
No, that part you've missed is that it's a different 40W bulb. A 240V 40W bulb will be made with a much higher resistance than a 24V 40W bulb and you can't simply swap them or you will have either a bulb blown to bits (24V bulb run on 240V) or very very dim or no light (240V bulb on 24V).
Steve