That comes back to the money walks thing.
Cost of moving freight.
Cost of getting a candidate elected and keeping the donors happy while in office.
Trucking will never go away. Not in our lifetimes. Can't back a locomotive up to a dock.
But I do know you can get boxcars next to a building and load and unload.
Used to load them in my twenties.... Not the 1920's....my twenties.
They do it now and eliminate the trucks altogether. So it can be done but it will and would take alot of planning and time.
Up through the 1950's railroads were big in LCL freight, the railroad equivalent of our LTL freight. They operated fleets of boxcars which were the equivalent of our trailers. They had huge breakbulk freight terminals where they unloaded and reloaded boxcars the same way we do now with trailers. The growth of the trucking industry and the improvements in the highway systems killed off that type of railroad business. When I was a kid in the 1950's there was a 3 mile long RR branch near my house. I rode with the RR crews numerous times as they switched cars for all the industries in the area - car loads of coal for a paper mill, a textile mill and a coal/fuel distributor, empty box cars for a carton mfg company, empty gondolas for a couple of scrap yards, refers of fruit and vegetables for a couple of distributors just to name a few. Those business are long gone replaced by condos and the tracks are long gone also. The railroads today no longer operate that way. They haul bulk commodities like power plant coal, grain, containers/trailers and waste/garbage/trash. Hardly any switching/spotting individual cars at various industries anymore.