The solution is to use the Pi Zero.This can be done with ANY kind of Pi
The least-expensive solution is to use the Pi Zero.
The text of this link is way totoo long to post here, but the Zero can be any kind of HID. Keyboard, mouse, flash drive, camera, whatever you can think of.
Turning your Raspberry PI Zero into a USB Gadget
Making it a keyboard or mouse is easy.