Trading helped them rise since they were immensely rich in things like Salt which was even worth more than gold in many parts of the world. Having secure trade routes and taxing traders made the country rich and powerful. This led to the decline since such wealth meant that many foreign enemies would want to attack them and take it from them which is what happened to both Mali and Songhai empires.