The card reader when supplied probably has a unique to your account mirror image of the processing algorithms stored at head office, so it knows in advance chronologically what code will be provided by your standalone device.
I used to have one of these when I banked with Barclays. Things may be different now, but I remember being in branch to effect a long forgotten transaction, had the card reader with me. Teller used a bank supplied reader on her desk to access my account (wouldn't use mine in case it had been "tampered" with).
I did wonder at the time whether it had something to do with the date/time of access to generate a code, but never got to the bottom of it.
When I moved banks I offered to drop the reader off at a branch, but was told to bin it as its security could be suspect.