EU does allow states to subsidize transit (including trains) but the subsidies are subject to all sorts of regulations. They have to be of "public interest" and to not generate (excess) profits for the companies. At least in theory.