The economic status of Jesus' family was anything but rich before his birth. This situation, however, would dramatically change with the appearance of the Magi (wise men).
Before the Magi's arrival, Mary and Joseph could not afford much beyond the necessities of life given Joseph's job as a skilled craftsman or carpenter (Matthew 13:55). The family was not rich by any means but rather lived (in our modern terminology) from paycheck to paycheck.
After the birth of our Savior, the family travels to Jerusalem's temple to present him before God and to give the required offering. Unable to afford the more costly offering of a one-year-old lamb and either a dove or pigeon (Leviticus 12:6) they give the far less expensive two pigeons or doves (Leviticus 12:8, Luke 2:24).
The appearance of the Magi, shortly after the family arrives back in Bethlehem, completely changes the financial status of the family. These "wise men" were influential and rich members of one of Parthia's two ruling classes who were willing to travel over 1,000 miles to worship (not merely honor, see Matthew 2:2) the King of Kings.
In his book, "The Lost Ten Tribes of Israel . . . Found!" author Stephen Collins states the following regarding the gifts given by the Magi.
"This Parthian delegation was offering tribute money to a 'king,' and therefore would more likely have brought a whole train of pack animals loaded with gold, frankincense and myrrh . . .
"The Parthians regarded Jesus as royalty, and it was the ancient custom to give a royal personage a truly worthy gift when coming into his presence.
"Since the Parthian Magi were directed to Jesus by an angel of God, their sense of awe likely resulted in unusually large gifts being given to Jesus" (first revised edition, chapter 9)
After the rich Magi leave Bethlehem, an angel tells Joseph to take his family and flee to Egypt (Matthew 2:13 - 15). Mary and Joseph, who only recently barely afforded a temple offering of two birds, now have the financial means to not only travel to Egypt (a fulfillment of prophecy, Matthew 2:13 - 15) but also to stay there at least five months!
The family, upon the death of Herod, then make the long trip back to Nazareth. God made sure, through the riches of the Magi, that his beloved Son had the resources available in order for his life to be protected.
The possible benefits received from the gifts left by the Magi do not end, however, with the above!
Joseph, Jesus' stepfather, dies sometime between Christ's twelfth birthday (Luke 2:43) and several years before his ministry starts at thirty. His death leaves at least six children (not including Jesus) without a father and breadwinner.
How did Mary, as a widow, afford to raise and feed seven children total? It appears highly likely that the riches given by the Magi helped sustain the family after Joseph's death. Stephen Collins writes the following in this regard.
"the Parthian Magi had lavished gifts of gold, frankincense, and myrrh upon Jesus when they had visited him shortly after his birth . . . Jesus (as the firstborn son and head of the household after Joseph's death) could have tapped that wealth to provide for his family's needs without having to work as a carpenter" (ibid. page 399).
The riches freely given by the wise men may have also funded Jesus' ministry. Consider the following possibility. There is no hint in the gospels that Christ ever asked for donations, although some, out of generosity, did willingly support him (Luke 8:3). The ongoing expenses for twelve men traveling for at least three years would have been significant (remember, none of the disciples were rich and all had left everything to follow him).
Judas regularly stole from the disciple's collective money bag (John 12:6, 13:29), an act which would be easily noticeable had the group had little cash. The Bible also indicates that the group regularly gave money to the poor (John 12:5, 13:29). Where did all this support come from, for group expenses, aid to the poor and so on if not (at least partially) the Magi?
Jesus had enough finances not only to take care of his disciples but also to give to the less fortunate. It is entirely possible that the rich Magi gave a big enough offering to the Lord to fund his public preaching of the gospel!