Most big cities, like São Paulo and Rio de Janeiro, are squeezed in between the ocean and “the shield”, a high rise in mountains just next to the coastline. Export in Brazil is made difficult by few navigable rivers connected to the coast.
So when you see images of vertical favelas, that’s the consequence of living in a small, narrow, shoeboxed plain sprinkled with towering mountains. There’s just nowhere else to go.
but it’s nearly 800m high! Compare that with the Mississippi, which can be navigated up to Minneapolis, which is just 200m high and 3,000 km inland. All the land from there to New Orleans can benefit from navigable rivers to ship what they produce. São Paulo can’t do the same even if it’s a stone’s throw away from the ocean!