Until 1984, the Santa Fe Railroad moved freight cars across the San Francisco Bay by barge. Railroad cars were decoupled from trains and loaded onto special "carfloat" barges, which were pulled across the bay by a small fleet of tug boats, to be re-attached to trains at the other end. The service ended when a fire destroyed the Point Richmond pier (the East Bay terminal for the operation), and that was that.
A handful of rail carfloat operations continue in the US, most notably in NY Harbor.
Rail carfloat services make economic sense only under a narrow set of circumstances, where there's no natural place for a direct overland rail link, the alternative route is very long, and the volume of traffic is too low to justify building a bridge but too high to make it practical to unload and truck the freight by road. San Francisco Bay and NY Harbor are two examples. Crossing NY Harbor from the mainland by freight rail, for example, involves a 250 mile detour upstate and back.