In the backend, there is no difference between labels mode and folders mode; all of the changes are in the UI. There are no IMAP attributes or keywords (they're poorly supported by third-party clients); any email message can appear in more than one mailbox, where "mailbox" means "folder" or "label".
On disk, mailboxes are stored as UNIX directories: all copies of the message (i.e., in all folders/labels) are hard links to the same inode. Over IMAP, each can have its own metadata (\Seen and \Flagged, for example), and they'll probably appear as separate copies (depending on how your client decides to do things).
As you say, JMAP has this built in: each Email object has a MailboxIds property. When the web client (or your own bespoke JMAP client!) fetches emails for one folder/label, and then you click to a different folder/label, the client doesn't have to download that message again, because it already has it in its local cache.