As I wrote in another thread, on my 2019 27" iMac its fixed after doing a SMC reset. I also had the problem that after waking up from sleep mode, scrolling didn't work with my Magic Mouse 2.
The problem with M1 Macs is that resetting SMC is not possible, see also:
Apple does not offer a way to reset NVRAM or SMC on an M1 MacBook? So, to know how to deal with such issues in MacBook powered by the new M1 Chip, let’s explore further.
rapidrepair.in
(on an Intel iMac: shut down, remove power cord, wait a few minutes, put it back and press on & reboot .. you'll have to reconnect the mouse, so slide the power button off/on ... for Intel MBs see the link)