Not sure about panning the Nile Divebuddy - it's mostly a very deep in alluvium. They certainly had a great capacity to produce gold within their own boundaries especailly when they laid claim to the Sinai peninsula.
Where did the wealth come from? Mainly from the fantastic productivity of the land, yielding 3-plus harvests a year and constantly replenished by the Nile flloods, so there was no issue of soil depletion. There was just (for the most part) a constant and abundant supply of food.
This meant that even in the earliest times, large non-peasant populations could be fed. Priests, soldiers, professional craftworkers, perfumers, lapidarists, etc. Egyptian crafts such as cut gems and linen were traded out, and Egypt at its most powerful controlled the trade and politics of countries from Anatolia to Basra to Crete. That meant effectively they agreed not to attack in return for 'tribute' ie a hefty slice of whatever made those countries wealthy. So Egypt just became richer under its own momentum.
The other half of the case is that this growth also happened because other countries lacked the longevity, food resources and consequent stability that made Egypt prosperous.
The major cults acted in ways that we would recognise as business corporations - they ran farms, traded, employed staff, and were very rich. And this feeds into the tomb-treasure thing. Pharaoh needed his cult priests to ensure the correct burail rituals, including the treasures to enjoy in the afterlife. Although Tut's tomb was amazing, he was a bit player. But of the major names, not a single tomb has been discovered intact. It's my personal belief that the priests ensured the rapid evacuation of most of the treasures through the back door, probably at the time of the burial. I suspect most of the tombs were emptied quite quickly and the gold recycled back into the economy. As you rightly point out, otherwise the demands on gold production would be truly boggling.
Ancient Egypt's phenomenal wealth relied not just on farming but on very close social cooperation, to ensure the damming up of floodwaters to feed the crops, and the storage / distribution of food harvests.