Others have written plenty over the usage and production of grain across this period, so I will not repeat that here. However, let us not forget that Egypt sits on a huge river, emptying into the Meditterranean Sea. This gave them access to abundant fish, as well as products from both up and down river. We should certainly assume that the Nile dwindled over time, and may even have dried up entirely, but this is not remarked upon in the text - indeed, one might expect this to be mentioned in the text if such a thing did take place.
We have evidence from around Joseph's period (~2000-1600 BC and earlier) that Egypt established direct trade with distant kingdoms right down the African coast, as well as indirect trade through third parties. In fact, it's likely that they had direct connections with other world powers like Mesopotamia even a millennium earlier.
Never underestimate the lengths that a trader will go to in order to make profit, or from what distance they can smell that profit potential! If Egypt was raking in funds from selling grain during a famine, it would then have funds available to purchase grain and foodstuffs from surrounding regions.
So in summary:
- The grain they had stored was able to be rationed sensibly, especially as they had a good idea of how long it needed to last for.
- Egypt and the coastal settlements had access to abundant fish from their own locale as well as further out into the Mediterranean where necessary.
- We have evidence that Egypt had established many trade routes in various directions by this point in history, and so if they were accruing wealth through the selling of scarce grain, they would likely have used this wealth to purchase food or other necessities from surrounding powers. Where there is wealth, there is usually a way!
Given that they had seven years to plan for this event and all of Joseph's God-given wisdom to do so, it's worth considering that they may have built additional boats or established routes and plans to cope with the extended famine.