Can the Magic Keyboard be used with the USB-C to Lightning cable?

Yes, you can connect it up with the USB-C to Lightning cable and use it as a keyboard.

USB is backwards compatible in this manner with the previous versions of USB. The Lightning port really carries a USB signal for data purposes.