Ma'aruf the cobbler and his wife Fatimah live in Cairo. Fatimah wants a vermicelli-cake, but when Ma'aruf is finally able to get one, it has the wrong kind of honey and she hits him. She complains about him and has him arrested. The Kazi (judge) takes pity on them and gives Fatimah a dinar with which to buy another cake. However, Fatimah has also complained to another Kazi and to the High Court, so Ma'aruf flees to another city. He meets an old friend, Ali, who has built a business from pretending to be a wealthy merchant, and wants to help Ma'aruf do the same. However, Ma'aruf overdoes it and draws attention to himself. The King eventually offers to wed Ma'aruf to his daughter Dunya. Ma'aruf spends almost the entire contents of the royal treasury before telling Dunya the truth that he has no money coming in and is poor. She tells him to run away, and tells the King that the baggage train was attacked by robbers and Ma'aruf had to go look after it.
Ma'aruf begins to work in the fields for a ploughman, and finds a stairway into the ground, within which is treasure and a seal-ring containing a Jinn. The cobbler distributes his treasure to people throughout the city, but the King and Vizier think it strange that a merchant only gives money away and never sells anything. The curious Vizier gets Ma'aruf drunk and learns the source of his wealth. He steals the ring, sends Ma'aruf and the King away to starve, makes himself Sultan, and attempts to marry Dunya. However, Dunya steals the ring and sends him to prison, where he is put to death. She brings her father and Ma'aruf back, but keeps the ring to herself and uses it carefully. She and Ma'aruf have a son and she dies five years later.
Fatimah eventually finds Ma'aruf and asks for his forgiveness. He says that he will make her his queen, but she tries to steal his ring. Ma'aruf's son stops her attempt and kills her, and Ma'aruf lives happily, marrying the daughter of the ploughman.