Neon-lamp type tester glows on gooseneck lamp adjustable shaft
It is capacitive coupling. You have a metal wire running inside metal shaft, with insulation between them. That's basically a capacitor. So there is unwanted stray capacitance from the AC wires to the metal shaft which is due to the structure of the lamp.

When AC voltage is wiggling on the wire, it gets coupled via the capacitance to the metal shaft, and this can be easily measured, sometimes even felt as a sense of vibration when sliding fingers on the metal shaft.

The less there is load from the measuring device, the more voltage your measuring device shows. Basically if there is no load at all, full AC voltage can be seen at the metal shaft. This is why it lights up the neon lamp tester, but it will have quite low current. When loaded with 1 megaohms of the oscilloscope (I assume 1x probes here), the voltage is much lower, and when loaded with old multimeter, it can be barely measured. If you live in a 110V 60Hz country, getting 30-40 VAC at 1Mohm oscilloscope should approximately equal to 1-2 nF of capacitance. If you live in a 240V 50Hz country and oscilloscope has 10x probes with about 10 Mohm loading, the capacitance is below 100 pF.

Basically, it should be safe, even though it is annoying. Some lamps are like that when bought new.