Calculate how much current can flow through 10Mohm at 400V. It's not a lot!
Here's an example of how protection is implemented.
First, we apply 25V to a 10x probe:
Now we'll up the voltage to 250V:
Notice how the input to the amp never goes above 5.5V? That's because the protection diode kicks in when the voltage goes above 5V (plus a diode drop). This works because the current is being limited through the impedance of the probe and the scope's attenuation network. So, only a few microamps are allowed to flow, which the protection diodes (and ultimately the 5V rail) absorb.