A king who had lost his kingdom, a merchant thrown out by his own family — the two met in a forest.King Suratha and the merchant Samadhi came to sage Medha. One grief: why does the mind still cling to those who betrayed us?The sage said: this is Mahamaya's maya. Then three stories — Madhu–Kaitabha, Mahishasura, Shumbha–Nishumbha — the Saptashati.Both made a clay goddess on a riverbank and worshipped three years. She appeared — the king got his kingdom, the merchant wisdom.
Source
Markandeya Purana, Devi Mahatmya (chapters 1 and 13)