https://en.m.wikipedia.org/wiki/Sacramento_Northern_Railway
The Sacramento Northern Railway (reporting mark SN) was a 183-mile (295 km) electric interurban railway that connected Chico in northern California with Oakland via the California capital, Sacramento. In its operation it ran directly on the streets of Oakland, Sacramento, Yuba City, Chico, and Woodland and ran interurban passenger service until 1941 and freight service into the 1960s.
One big upside is road wear and tear. Damage to roads from vehicle weight is proportional to the axle weight raised to the fourth power, meaning heavy vehicles like trucks do the vaaaaast majority of road wear. Steel tracks can carry much heavier loads.
Another is train boxcars can be unloaded from the side, in parallel, unlike trucks that need to be unloaded from a small opening in the back.
Another is it’s easier to electrify, and you don’t need rubber tires, so you avoid a lot of emissions (CO2 from fossil fuels and particulate matter from tires).
Finally, you need an asphalt road to support trucks. With cargo trams, you can have non-impervious surfaces like grass that no other cars can drive on, meaning you don’t accidentally induce demand for passenger cars when building infrastructure for commercial trucks.
And yeah, a big downside of course is needing way more tramways, but I don’t necessarily see that as a bad thing to have. Just makes the switchover longer and costlier.
That said, I think trams make most sense for bigger stores, e.g., grocery stores. For regular Amazon deliveries? Not so much. For those, neighborhood electric vehicles (basically glorified golf carts) are probably more suitable. Most delivery vans run well below cargo capacity most of the time anyways, meaning they don’t really benefit that much from the capacity of a larger vehicle.