If they're state owned then they should be doing what's based for the people of the country and instead use that money to provide better services, decrease fares or even just reduce the overall tax burden of the country. Although even if they were entirely private and had every right to decide what to do themselves it wouldn't protect them from criticism.
If it's state owned then any money it makes is effectively owned by the state, and therefore by the people, so they're still giving away taxpayer money.
For context, the railroad was paid by the Nazi's to deliver 102,000 people to concentration camps.
And yes, it absolutely is disgusting to pay taxpayer money out to people. The taxpayers had nothing at all to do with those deaths and shouldn't have to pay for them.
I think your priorities are backwards if you think wrongful "taxation" is worse than a railroad paying out to Holocaust survivors.