You might be thinking of the Dev network keys (MSDN).
MSDN used to be free so this was a common approach, but they re-org'ed all their programs so I think those keys are now hiding under the paid MSDN program...
If you have a university that supports alumni, Microsoft grants a key to each student, faculty, and alumni in most of their post-secondary education plans.
My other recommended way is through the Startup Hub.
MSDN used to be free so this was a common approach, but they re-org'ed all their programs so I think those keys are now hiding under the paid MSDN program...
Windows Server Datacenter has "AVMA" that will automatically activate an unlimited number of VMs within it if you use the correct AVMA key but the host needs to be activated first. Those keys are freely listed on Microsoft's website but won't work for anything else.
You can also use the free 180 day trial of Windows Server both on the host and as VMs. You can then rearm that 180 day trial 5 times which gives you several years of free use that should be plenty for a homelab; they'll likely have Server 2025 out by then.
Additionally there is a 100% free "Hyper-V Server 2019", no AVMA and no GUI but you can use it as your host without worrying about expiration. This was discontinued so there isn't a Hyper-V Server 2022 but it's still supported with updates until 2029.