Det är troligt att Hogwarts Express anses vara en förlängning av Hogwarts själv. Detta skulle vara den enda anledningen till varför Underage Magic utförs ombord utan straff.
There have also been examples of underage magic being performed aboard
the Hogwarts Express without penalty, perhaps suggesting the train is
considered an extension of the school grounds (such as when Ginny
Weasley used the Scouring Charm to clean up a compartment following a
mishap with one of Neville Longbottom's plants.
Order of the Phoenix (Scourging Charm use on the train)
Det finns några exempel på att magi utförs ombord innan han når skolan.
Nu enligt wikien användes Hogwarts Express specifikt för att transportera barn utan misstänksamhet med hjälp av en dold charm (som förhindrar upptäckt från muggles).
Sometime in between 1819 and 1849, Ottaline Gambol rose to the office
of Minister for Magic, and she made a daring and controversial
suggestion to solve the ages-old problem of how to transport hundreds
of students to and from Hogwarts Castle every school year without
attracting the Muggles' attention: intrigued by the Muggle technology,
the Minister saw the potential of using a train as a secure and
comfortable alternative to Portkeys or to unregulated means of travel.
The Ministry of Magic conducted a a large-scale operation involving
one hundred and sixty-seven Memory Charms, as well as the biggest
Concealment Charm ever performed in Britain, in order to acquire the
locomotive. The morning after this operation, the residents of
Hogsmeade awoke to find the gleaming red Hogwarts Express and a
railway station that had not been there previously, and the Muggle
railway employees in Crewe had the feeling they had misplaced
something, which stayed with them for the rest of the year. There
was initial resistance from pure-blood families against using a
Muggle-built device for wizard transportation (which, they claimed,
was "unsafe, insanitary and demeaning"), until the Ministry decreed
that students would arrive to school on the train or not attend at
all.
Source : Pottermore information on the Hogwarts Express
Detta övergripande möjliggör säker transport av studenter till Hogwarts, och jag tror också att det tillåter dem att kasta magi utan straff på grund av den extremt stora Concealment Charm också (muggles skulle inte kunna bevittna några handlingar av magi och studenter brukar avstå från att utföra farliga stavar ombord också för det mesta).