I stopped off to get some fuel at a Motorway services.......
Capitalism and profiteering is everywhere.
No, it's economics. Supply and demand, and probably goes back for a few millenia. If the supply is limited and the demand is there, the price goes up. With a trolley on a train, there's somebody's wages to be paid and the trolley to be paid for and maintained out of the revenue from sales.
Fuel prices on motorways have always been high. If you know that and don't like it, fill up before you join the motorway. But alternatively you might decide it's worth paying a higher price (perhaps for a small amount of fuel) to avoid the inconvenience and extra time if you leave the motorway to look for a petrol station that's cheaper.
At railway stations, particularly the larger ones, Network Rail or the local TOC are charging a rent (probably high) for the premises which someone or some company is prepared to pay because they calculate that passengers will be willing to pay higher prices which will enable them to make a profit after they've paid the higher rent and all the other costs of running their food outlet. We don't have to pay those prices. We could make our own sandwiches before we set out from home. But many people find it easier not to think about food for the journey till they get to the station, and then blame capitalism, privatisation, Brexit (or the lack of it), climate change, you name it....