In this episode, Shi Mifu's mother-in-law tells the history of Xiaoma Valley.
Roughly speaking, when Mrs. Smith was a child, the Apple family were pilgrims and traveled around collecting seeds. Then they came to Cantelot and met the princess. The princess asked them to settle in Cantelot and the endless forest. There was no pony valley at that time. They worked hard there, but one day, Shi Mifu's mother-in-law went out looking for food and found a magic apple, and then they began to study how to make delicious magic applesauce. In the end, the ponies came all the way to taste their magical applesauce, and even some ponies decided to settle down and slowly build a pony valley. Tiara's grandfather also made a fortune with apple's magic applesauce.
If my answer is helpful to you, please give me a favorable comment, thank you!