We have the largest rail system of any country (USA 220k km vs EU 200k km). If you include the connections we use with Mexico and Canada it’s even larger. It’s almost all entirely freight. Trains can be 2000m long compared to 700m in the EU. It’s all built for freight.
2 km long trains are not long in the US anymore; in the west 3-4 km lengths are being seen more and more often. Turns out slower, longer trains filled with bulk commodities are better for business since they don't have tight delivery deadlines. There are towns where the train comes through for 45 minutes+.
Rail operators have also discovered a really nice side effect of ultra long trains: you don't have to pull into a siding to let a passenger train by as required by law if your train is longer than the siding.
Supposedly 10% of trains in the USA are about 10,000 feet or longer. Duckduckgo tells me that's about 3km. Supposedly there's at least one train 14,000 feet or longer.