This metaphor helps readers understand how valuable the words were to the girl. Pearls are rare and expensive finds. To the girl the mothers words gave her hope and meant more than treasure to her. The metaphor expresses her appreciation and gratitude for the mothers words.
If you are making an ad to want people to go to pizza hut you have to try to convince the people that the food and drinks there are good and maybe they can get a good deal.