It's not illegal in the UK, Wolf63!
There's no statutory limit on the number of passengers which can be crammed onto a single train. All of the safety surveys show that having passengers standing with their noses buried in other people's armpits is SAFER than everyone having a sea. (That's simply because it's almost impossible to be thrown any distance in the event of a collision).
I've only ever seen one UK mainline train with a loading similar to that one. (It sticks in my mind because I was responsible for trying to safely despatch it, with several thousand people still crammed onto the platform alongside it). It occurred after a free Radio 1 event (on the hottest day of the year) discharged 120,000 people out onto local roads, buses and trains. A mainline train (on the route I worked on) carries about 450 passengers. If I was to report that a train left 'full and 50 standing' it was very busy. If I reported 'full and 200 standing' it was 'close to the normal maximum capacity. On that occasion I reported 'full and 1200 standing'! (And yes, we did push quite a few passengers on through the doors!)