@Arjun Sir
why transfer rate matters here? Priority is based on how critical a device is. In many real-time systems, a keyboard should have the top priority but on a computer system, I guess this is a bit ambiguous.
The speed of I/O devices matters here because if we talk about keyboard then one can maximum type 3-4 characters in 1 sec. and within 1 sec, our CPU can execute millions of instructions(MIPS) depends on a frequency of the processor, main memory, and cache data transfer rate is faster than a keyboard, printer, scanner etc..
If CPU will service interrupt of the keyboard then there will be a chance that MM which has high data generating speed within some buffer, we might lose some data that is the reason CPU has to first service interrupt of higher speed device than compare to slower ones. That is how interrupt driven priority based I/O implemented.