I get it now.
The nodeMCU input pin it set to INPUT_PULLUP, so it will source a very small current. Perhaps that is enough to light the led, although I expect it would be very dim.
When the switch is closed, the voltage from the input pin will be shorted to ground and the led will go off.