The Tosefta (Sota 10:3)1 notes this very apparent inconsistency and uses it to derive an example of the principle (introduced in 10:1):
בזמן [שהצדיקים] באין לעולם טובה באה לעולם ופורעניות מסתלקת מן העולם וכשנפטרים מן העולם פורעניות באה לעולם וטובה מסתלקת מן העולם
When righteous people come to the world, goodness comes to the world, and calamities are removed from the world. And when they pass away from the world, calamities come to the world, and good is removed from the world.2
The Tosefta identifies the arrival of Yaakov in Egypt as the event that changed matters between Yosef's prediction of five more years of famine and his subsequent distribution of seed for planting.
עד שלא ירד יעקב למצרים היה רעב שנא' (בראשית מ״ה:ו׳) כי זה שנתים הרעב בקרב הארץ וגו' משירד מהו אומר (בראשית מ״ו:ח׳) הא לכם זרע וזרעתם את האדמה
Until Yaakov went down to Egypt, there was famine, as [the Torah] says (Genesis 45:6), "It is now two years that there has been famine in the land ..." After he went down (Genesis 46:8), here's what it says (Genesis 47:23): "... here is seed for you to sow the land."
The Tosefta goes on to extend the idea of the link between the famine's cessation and Yaakov's presence, using an interesting textual proof:
א"ר יוסי כיון שמת יעקב אבינו חזר הרעב ליושנו שנא' (בראשית נ׳:כ״א) ועתה אל תיראו אנכי אכלכל אתכם [ואת טפכם וגו'] נאמר כאן כלכול ונאמר להלן כלכול מה כלכול האמור להלן רעב אף כלכול האמור כאן רעב
R' Yose said: Once Yaakov our father died, the famine returned to its previous state, as [the Torah] says (Genesis 50:21), "And so, fear not. I will sustain you and your children ..." It says "sustain" here, and it says "sustain" there [in Genesis 47:12]. Just like "sustain" over there was in the context of famine, so "sustain" here is also in the context of famine.
In other words, just as Yosef had to "sustain" his family during the early years of the famine, when they were all in Canaan, the fact that he had to "sustain" them once again now after Yaakov died indicates that the famine must have returned.
1. Hat-tip for the Tosefta reference to Rashi on Genesis 47:19, and to Tamir Evan for pointing to that comment of Rashi in a comment on the question here.
2. The translations of the Tosefta and some additional inserted Scriptural references in the English are mine.