Edit...
"Trying to erase & restore M1(2021) iMac without previous owner's Apple ID (she died 3 years ago): A friend of mine gave me his mother's M1 iMac, OS Monterey, saying he doesn't know his mom's apple ID and password (she passed away). He said it's useless to him but I can have it, with the understanding that I erase and restore it to factory settings before using it. It was purchased in 2021 and he doesn't have any proof of purchase, so I figure we're out of luck. I've scoured youtube and everything I've found just circles back around to needing her Apple ID. ideas? Many thanks."
-------
Likely being out of luck, you might, (by chance) be able to achieve this, through use of a death certificate...
Getting Into a Ceased Member's Apple Account and Device:
1. Get in to the Account:
Using a Birth Certificate, your friend might be able to get into her Apple Account. Go Here: Request Access to a Deceased Family Member’s Apple Account - Apple Support
2. Once In the Account...
See about getting into the Mac. Go here: If you Forgot your Mac Login Password - Apple Support
3. Once in the Mac:
Have your friend perform as instructed here, including the iCloud logout, and Time Machine Backup creation, if desired: What to do Before you Sell, Give Away, Trade in, or Recycle your Mac - Apple Support