Many modern mice have onboard memory, actually, to store sensitivity settings and occasionally macros.
I doubt they need more than a few kb's for them, but being 2021, maybe the cheapest onboard memory chip can still hold 16MB or more, and a sufficiently cunning hacker could use it as a storage of last resort.