West African kingdoms built large armies to defend their trade interests and the people who supported them. They also created powerful trading empires whose wealth was tied to the trans-Saharan trade networks. These empires developed strong economies and grew into major powerhouses with powerful rulers and extensive territories.
The first of these was the Ghana Empire (6th-13th century CE). This Mande empire in modern-day southern Mauritania and Mali relied on gold from the Ghiyaru, Galam, and Bure goldfields. The kings of Ghana taxed the merchants who came through their territory to control the supply and prevent price inflation. In turn, the kings of Ghana grew wealthy and could even fund a military campaign against rival African states.
But the Ghana dynasty eventually collapsed and the Songhai Empire (15th-16th centuries CE) arose in its place, using the same tried-and-true wealth accumulation methods. The most significant change, however, was the shift from direct trade with Europeans to indirect trade through the Gulf of Guinea. This rerouted much of the gold and slave trade across the Atlantic Ocean instead of through the Sahara desert.
The Songhai empire also controlled the salt trade from its sources in the Sahara (like the Awlil mines) and its trade cities (like Timbuktu). A kilo block of salt cost around 450 grams. It was loaded onto boats and transported down rivers like the Niger and Senegal. It was then cut up into smaller pieces and sold in villages throughout the interior of West Africa.