During the Cold War, the train on the Trelleborg-Sassnitz ferry went to West Berlin ... through East Germany with no getting on or off over that stretch.

BTW. I was on the Hamburg-Copenhagen train on the Puttgarten-Rødby ferry in 2015 during the height of the Syrian refugee crisis. I had changed my booking to earlier trains because of expected delays. It and connecting trains were packed, as were the train stations, also with immigration officials and volunteers. Brings tears to my eyes to this day.