If you acquired a reputation for religious scholarship, you might hope to gain a position with a waqf, which gave you status if not riches, and you didn’t have to hail from a famous family to become a famous religious scholar. You just had to have brains and a willingness to practice piety and study hard.