Ah! Well, there is an interesting point. ![]()
"Can't" is of course, true, but yet not true. If you feed 12 V to the Mega (or UNO, Leonardo) "Vin" or the equivalent "Barrel jack", then the supply selection circuit isolates the 5 V supply from the USB port. But when the on-board regulator (which has no heatsink to speak of) overheats and shuts down because you draw more than 150 mA or so and it is dropping 7 V (which at 150 mA is 1 Watt dissipation) then you have no 5 V supply.
The concern regarding powering via 5 V to the "5V" pin - which is the correct and reliable way to power it - is that if a PC is connected to the USB port, the 5 V may feed back into the USB interface of the PC and cause that part to malfunction. Note clearly that this is not a problem affecting the Arduino, but possibly to the "PC".
Now that would of course, only be a problem if the 5 V from your Mega power supply exceeds the 5 V in the PC. And I do not know how the USB ports of the Pi are arranged. If their 5 V is simply directly connected to the 5 V main supply of the Pi, there is no problem at all; the only problem is if it includes some exotic current limiting circuit to its USB port as in a PC or laptop.
If you can locate a circuit of the Pi, you could check this out. But if your 5 V supply to the Pi is the same connection as to the "5V" pin of the Mega, this is unlikely to be a problem in any case.
A simple solution is in fact, to connect your main 5 V supply to both the Pi and the Mega, and disconnect the 5 V line in the USB cable from Pi to Mega. Alternatively, if you can be sure that the Pi can deliver sufficient current from its USB port to power the Mega and its attachments (up to 500 mA) then just power it via the USB port and do not connect 12 V to "Vin".