In my understanding a
device has its origin in
giving advice and does something specific for you (a pen is a writing device, a mixer is a cooking device, a phone is a communication device, a bus is a transportation device etc.).
A machine on the other hand has its roots in its mechanisms. It physically transforms something by applying mechanical power, and that's not necessarily done for you (e.g. printing device VS printing machine).
Whether a device can be composed out of many smaller devices, or whether a machine can be composed out of many smaller machines just doesn't seem to be relevant. That being said, language evolves with time and certain concepts find some overlap in general usage.