Kabam will never say how, but I have a theory
There's been so much discussion about how Kabam could catch account sharers. How do they tell if some is sharing their account outside the TOS.
To sync up with Kabam servers, you have to register an email address and password. Simple enough. And that' seems to me what gets shared. Never done it; never would. However....
Not exactly sure how it works in the background, but my MCOC accounts are linked to my Apple GameCenter account. Every time I startup MCOC, the Game Center banner appears. (Never had an Android device but I think there's a Google Play?). And that is tied to my Apple ID which identifies my devices and is the same across my Apple devices. So, it would be fairly easy for Kabam to determine if there is account sharing--if an MCOC account is used by two separate, distinct Apple (or Google Play) accounts, it's a shared account. There's no way for them to evaluate if two people share a device (father/son, husband/wife, etc) as long as it's the same device or Game Center account. No concern for trying to catch via IP addresses, player cities/countries or even devices. Since your alliance mate has a different device, and it is registered under a different Game Center/Apple ID, then when he logs in for you, it indicates you shared it. Can't be the device ID/serial number either because, again, you can play the game legally as your account on multiple devices.
Now, about multiple accounts on the same device--there's no restriction on having multiple MCOC accounts on the same device. The tricky part comes in when a family has multiple devices AND each device is tied to a separate Apple/Google/device OS manufacturer account.
I work in Data Architecture & design large databases but am not familiar with the interactions with these platforms but I would find it incredible if Kabam is NOT capturing the data necessary to match MCOC with device account with MCOC registration email
I'm sure the Data is gathered. They just have to mine it