> Why would failing a customs check cause you to be kicked off the train? Either your goods will be confiscated, or you'll be arrested etc.
It's easier for everyone if you deny entry rather than prosecuting for unlawful entry. If you can kick people off while they're still in a country they are presumed to be in lawfully, they can figure out their documents and come back later. If you arrest them in the destination country, they've got to figure that all out from immigration detention.
When you take a train from e.g. the Netherlands to Germany you're already within Schengen at the point of disembarkation.
The police might check your passport details, but you won't be "deported" back over the border you just crossed.
You might be deported from Schengen in its entirety, but then the fact that you just crossed a border isn't important, but e.g. that you overstayed a Schengen visa.
In cases where there is a border with a non-Schenhen country in Europe the train will stop approximately at the border, and you might be refused entry.
But for e.g. Austria to Germany the German police might board at the first German station after the bonder, and then walks the train as it's in motion. That's because it's a customs check.
It's easier for everyone if you deny entry rather than prosecuting for unlawful entry. If you can kick people off while they're still in a country they are presumed to be in lawfully, they can figure out their documents and come back later. If you arrest them in the destination country, they've got to figure that all out from immigration detention.