There appear to be a few conflicting verses and commentaries on this topic.
- When Joseph intreprest Pharaoh's dreams he says, Genesis 41:28:
ה֣וּא הַדָּבָ֔ר אֲשֶׁ֥ר דִּבַּ֖רְתִּי אֶל־פַּרְעֹ֑ה אֲשֶׁ֧ר הָאֱלֹהִ֛ים עֹשֶׂ֖ה הֶרְאָ֥ה אֶת־פַּרְעֹֽה׃
That is the thing which I spoke to Pharaoh: what God is about to do He has shown Pharaoh.
Then, Joseph explains to Pharaoh that there will be 7 years of plenty followed by 7 years of famine.
- When the brothers come to Egypt, Joseph says:
Genesis 45:6:
כִּי־זֶ֛ה שְׁנָתַ֥יִם הָרָעָ֖ב בְּקֶ֣רֶב הָאָ֑רֶץ וְעוֹד֙ חָמֵ֣שׁ שָׁנִ֔ים אֲשֶׁ֥ר אֵין־חָרִ֖ישׁ וְקָצִּֽיר׃
For these two years has the famine been in the land; and there are yet five years, in which there shall be neither plowing nor harvest.
What he tells his brothers concurs with how he interpreted Pharaoh's dream. 2 years have past another 5 years - a total of 7 years.
- But, later, we see that the Egyptians come at the 2nd year of the famine, and ask Joseph for food, Joseph says:
Genesis 47:23:
וַיֹּ֤אמֶר יוֹסֵף֙ אֶל־הָעָ֔ם הֵן֩ קָנִ֨יתִי אֶתְכֶ֥ם הַיּ֛וֹם וְאֶת־אַדְמַתְכֶ֖ם לְפַרְעֹ֑ה הֵֽא־לָכֶ֣ם זֶ֔רַע וּזְרַעְתֶּ֖ם אֶת־הָאֲדָמָֽה׃
Then Joseph said unto the people: ‘Behold, I have bought you this day and your land for Pharaoh. Lo, here is seed for you, and ye shall sow the land.
Q - If the famine was supposed to last another 5 years, what would sowing seeds accomplish?
A - Rash"i (among others) citing Tosefta Sotah* explains that when Jacob arrived, the famine stopped.
OK, that explains what happened, except for some puzzling contradictions:
- After Jacob dies, Joseph says, in Genesis 50:21:
וְעַתָּה֙ אַל־תִּירָ֔אוּ אָנֹכִ֛י אֲכַלְכֵּ֥ל אֶתְכֶ֖ם וְאֶֽת־טַפְּכֶ֑ם וַיְנַחֵ֣ם אוֹתָ֔ם וַיְדַבֵּ֖ר עַל־לִבָּֽם׃
Now don't fear; I will sustain you, and your little ones.’ And he comforted them, and spoke kindly to them.
Supposedly, the famine has ended long ago. Why does Joseph say "I will sustain you". If there's no famine, the family has food and doesn't have to rely on Joseph to sustain them. The family was wealthy and there was food available. Is this some implication that after Jacob died the remaining years of the famine returned?