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.
Also there is a lot higher traffic densitiy in main lines in Europe which also justifies the cost for building and keeping the infrastructure.