But that's not to take away from Switzerland having a very high percentage of trains being electric only.
I traveled some times from Zürich to Munich and saw that in the German side, rails have no electricity and then the SBB are forced to use a diesel powered machine, but except for that, I still have to find a connection where the diesel machine is necessary every time, I am curious!
Don't get me wrong, it's not huge numbers, but I see 'em.
So, disregard my blathering, I stand corrected (hopefully!)
That said, for 250km/h and up, electric is pretty much standard for rolling stock. It's a bit less common to have the freight going through the same infrastructure be all mandated to be electric too though.
(Also now that I look more into it, it's unclear that it's mandated that the trains that go through the tunnel be electric. In fact, Swiss Railways just bought some new rolling stock for maintenance that's hybrid electric/diesel (uses electric only when overhead power works, diesel otherwise) which makes sense for maintenance, but likely means the tunnel is perfectly equipped to deal with diesel emissions from trains. In addition, before they completed the overhead work, in 2014 they announced that diesel trains could transit the tunnel. Not open publicly, but that the capability existed. Anyway. Interesting question whether they actually require all rolling stock transiting the tunnel to be electric, and if so, why. I'm guessing it just currently happens that all the scheduled trains traversing the tunnel are electric, so the poster said "all electric".)
This is simply not the case in Switzerland. Most people take the train/tram if it is not reachable by bike.
Also there is a lot higher traffic densitiy in main lines in Europe which also justifies the cost for building and keeping the infrastructure.
The problems with electric trains is needing to supply and maintain catenaries, needing to source enough power, and needing to cope with highly variable electric demand (trains use much more power when they hit a steep incline). In the early 20th century, when railroads were replacing their steam locomotives, the rural electrification projects in the US just didn't exist yet, which made electrification of mainline railroad track quite expensive. The few railroads that tried ended up bankrupting themselves in the process.
Another drawback of electrification that's only obvious in hindsight is that installing catenaries makes enlarging the load gauge that much more costly--if the US had mostly electrified its freight track, it likely would have never developed double-stacked container trains (absent in much of Europe since the electrical catenaries provide insufficient clearance), a development which did much to revitalize the railroad industry.
The US has pretty good public transit in the places that have merited it prior to the widespread adoption of the automobile. If the city was large relative to its size today (geographically) in the early 1900s odds are good it's got acceptable to good transit.
The places which have mostly grown after the 1940s tend to have poorer transit as cars came to dominate.
Comparing what works in Switzerland with what works in the US doesn't make that much sense, though. There are plenty of stretches of railway in the western US that might be hundreds of miles between places big enough to warrant a substantial power station. Which means that you're going to have to pull hundreds of miles of high voltage lines (which aren't free) in order to have a stationary power plant power the all-electric locomotive. Or you can just drag around your own power plant, sans wires everywhere; a diesel.
There are other systems that do, though: PATH (for points immediately across the Hudson), NJTransit (commuter rail to a lot of NJ), LIRR (commuter rail to Long Island & Queens) and MetroNorth (commuter rail to points north in NY and CT).
Given how long it takes to ride the subway to the farther reaches of Queens (e.g., Jamaica), I can't imagine how long it would take to commute to Manhattan via subway from, say, Bayside Queens (which is served by LIRR).