Suppliers of unlock code submit the IMEI to the carrier or manufacturer and then the relevant party delivers an unlock code that is relevant to the user’s IMEI and it’s able to unlock the device.
Incredibly, this barrier can be bypassed with an unlock code. Several handsets are locked to the carrier they were supposed to be locked to and ask users for a code if they put in a SIM card that isn’t intended for the device.