Any device like the mouse you are asking about has a certain amount of ROM on it to tell whatever it gets plugged into what it is which driver to install and so on.
To Transfer Malicious Software it would have to have the ROM Chip Rewritten or replaced or the device supplied by a firm with suspicious Security Credentials like huawei who where banned for National Security reasons from supplying 5G critical Network Gear to quite a few countries because of Chinese Laws which required the hardware maker to report whatever the CHinese Governments tells them to.
It is also possible that any device can be redesigned and have extra chips fitted after it leaves the factory which can have Read Only Memory or maybe Programable ROM to even Random Access Memory that can be updated by whomever redesigned the device.
There are quite a few things that call home to Mummy to see if they will work today the leader being Microsoft Software which may have had it's current CAL added to the list of Counterfeit Software and is stopped from working by Mummy MS when it logs in but more likely it will download and apply updates which may stop it working because the CAL is no longer recognised as Legit and you need to reregister with Microsoft to get it working again. Happens quite a lot with Volume License Software but in reality it can be used to stop anything that calls home to MUMMY to be told if it can run today.
As Mice do not have RAM in them the likelihood is that they can not be changed easily and the person who wants to change them would need physical access to them to fit a new Circuit Board which while possible is highly unlikely. More likely is a remote device is setup somewhere that can intercept Wireless communication between WiFi Devices like Mice, Keyboards or Printers and that steals data that is being transmitted between the different devices or a Hardcore Cracker could install a device that can display any computer screen within range and save the screen images without bothering about WiFi connections. The reality however is that most WiFi between computers and networks is the easy point of attack and it is at that point that the system gets cracked.
So in answer to your question Yes it is Possible but it would be horrendously expensive to do be all but useless it's cheaper and easier to intercept things that call home to Mummy and that is just about every piece of software on any computer to see if it needs updating and cracking any server at a