Actually, train systems having its own assigned branches of police is common enough that there's a Wikipedia article[1]. Unique part is that the US doesn't have an umbrella national or state agency that such branches would be part of.
Two of the biggest are Canadian National Police and Canadian Pacific Kansas City Police -- and those two are deputized, in both Canada and the US, with Federal, State and Provincial police powers. Despite being railway employees they can cite you for, e.g. speeding if they catch you doing so. Either on or off railway property.