It's one mode of barcode readers and not a particularly good one as it can't do arbitrary binary barcodes for obvious reasons and comes with all kinds of security concerns when you're scanning untrusted barcodes. Sadly even though barcode readers usually also support other modes (e.g. emulated serial over USB), many of them support switching modes via special barcodes so remain vulnerable.
This is what any decent barcode reader does, by the way; and before USB, they would be inline taps that pass through a regular PS/2 keyboard.