The last decade has been a golden one for shipping goods around the world's biggest economy, and American railways have been a rare example of capitalism working well, with a virtuous cycle of demand, giant profits, and vast investment in rolling stock and tracks.