But even if they are useable and beneficial: That's not an argument not to use other available space as well.
There are still millions of open-space square meters all over the country. Think of flat-roof warehouses, supermarkets, parking facilities and more. Those places are easy to access, easy to install, easy to maintain. These train track installments however.... hard to install, require non-standardized panel sizes, non-standard wiring, special equipment, are in a dusty/dirty uncontrollable environment, maintenance is only possible in coordination with the train company. My guess is that these things are 4-5x more expensive on a per kwH basis, if you consider the total cost of ownership.
If you want grant money, you need something new, like a solar monorail!
On a graph, the money spent or the capacity installed has never been more than a blip of a blip but it gets eyeballs.
it's not like all of Switzerland is doing this on all rail tracks. It's 60 small panels. A tiny experiment, nothing more. Who says they are "instead of, I don't know, people's roofs"?
Government money would be much better spent on a regular solar installation on the ground. Much cheaper to install and maintain.
[0] https://www.techspot.com/news/98944-switzerland-installing-s...