I have no idea how much the Wi-Fi technology costs. It's mostly one supplier these days, and I assume there's a fixed cost. New trains will be wired up ready, so it's just the cost of the SIM cards and whatever subscription has been negotiated. But we know everything on the railway costs a lot of money, so don't expect it to be anything like buying a Huawei LTE router for £300 on Amazon! I'd say four figures, plus the need for the antennas, cabling, a server....
Clearly each train doesn't have a regular SIM with a set data allowance. I expect the data allowance is unlimited, but there WILL still be a cost and I can imagine it being a fair bit when you add it all up. Obviously loads less than consumer tariffs (where you may pay around 50p-£1 per GB) but when added up...
All in all, Wi-Fi provision will be a not insignificant cost and one we ALL pay for whether we use it or not. And once made free, usage will increase that lowers the performance and forces more investment (more concurrent 4G connections) which then makes it even more costly.
To be honest, paying for the service could make for a much better experience overall.