Why impedance between I/O pin and ground drops when Arduino is not powered I have a 4KHz 5V pulsed signal connected to Arduino UNO pin2 (ISR).

When the board is powered, the pulse is attached to ISR rising edge, and is working as intended.

I don't know the output impedance of the pulsed signal, but when the board is not powered, the pulse drops to 2V.

The resistance between pin2 and ground is about 500K when not powered. The resistance is infinite when powered.

The pulsed signal does NOT drop when connected to a 500K resistor.


Question:

What is the cause of the signal drop?
How to prevent it ? (It's not practical to disconnected the signal from Arduino, but I can make sure Arduino is always powered. How to deal with transient situations like reset ?)

Thanks in advance !
The Atmega328p (which is used in the Un[ (and actually all other AVR microcontrollers) has clamping diodes in the input hardware to protect it from overvoltage (above Vcc). When not powered, Vcc is at the same level as ground, so any positive voltage on an input pin is above Vcc. The protection diodes get conductive to protect the input hardware. Note, that the diodes can be fried easily, if a too high current flows through them. You should prevent that.
How to prevent it? By not doing it. You should never provide a voltage on an input of an unpowered chip (like any chip). If you really need to unpower the Arduino, you can prevent the voltage from reaching the input pin with a MOSFET.