Its because the governments are corrupt. If somalia had stability and no corruption today these people would be working in factories or offices
We are ruled by sociopaths who don't much care about the shacab as long as they're getting their bread. The kinds of houses "Somali elites" own both in Somalia and in places like the neighboring Khaleej would shock you. At least Khaleejis have the decency to let their people share in some of that bread while they do their despotism. African leaders are content with most of their people living in shanty towns while they sip fine wine and eat the finest grass-fed beef cooked by a gaal chef.