No, actually they don’t. Unlock codes are the most popular, and for most phones, they are the only method of unlocking, but there are other methods that can be used as well.
Apple iPhones are actually the most popular example here. It is also the one that gets the majority of confusion. iPhone unlocking actually doesn’t happen with the use of an unlock code at all. It is done by us requesting that Apple update their iTunes servers so the IMEI of the phone is recognised as unlocked. The unlocking process itself is when completed the next time the phone is connected to iTunes with a non-accepted SIM card inserted (and our instructions followed). No code is used by us, the user or Apple in this case.
The other most popular instance of phones being unlocked without an unlock code being used by the customer is for Nokia handsets. This method of unlocking isn’t available for all Nokia models but for some a software can be used for unlocking. The software has login details associated with it that we need to send out, but once the phone is connected, the software reads the phones IMEI itself and then conducts a search of its own for an unlock code. If found, the software then automatically inputs the unlock code into the phone, and once the phone is disconnected by the owner, it is unlocked. In this case an unlock code does exist but the owner doesn’t use it or have any knowledge of it being put into the phone.
There is phone unlocking software that exist that can unlock a phone by altering the phone itself, however because these don’t use either an official program like iTunes or conduct the unlock by inputting an unlock code, they can void the phones warranty. Simply ensure that whatever method you use keeps the phones warranty in tact. For instance, a phone can be unlocked once rooted/jailbroken. This then allows the owner to download and run programs on the phone that the manufacturer hasn’t given permission to be used on the phone. Programs such as those made for phone unlocking do exist and work. However, this definitely voids the phones warranty, so be careful if going down this route.