You have it backwards. Cargo railways are more developed in the US than in most of Europe. After the latest round of industry consolidation, most rail companies are highly profitable.
Trucks pay most of infrastructure costs through fuel taxes and registration fees.
Fair enough. I conceded I might be totally wrong because my conclusion is based on casual observation of passenger trains and their infrastructure rather than looking into the industry.
I could feasibly reach all cities and _most_ large towns by rail in Germany. Sure, it's slow as heck if you're not taking the express train with no transfers and few stops. But the infrastructure is there. Whereas in the US there are massive areas where the nearest train connection is hours away.
I assume there are factors with freight trains I don't know anything about, and if they're as profitable as you say then the infrastructure is actually very optimized for profitability; if there's somewhere worth reaching, the trains reach it.
Most cities and towns in the US aren't too far from some rail line. There probably will not be any passenger service on that rail though. Passenger rail service is practically dead for the majority of the US.
Trucks pay most of infrastructure costs through fuel taxes and registration fees.