on some phones the circuit that has the lock code is not affected by the firmware update, in others it is
the unlock process is just a one or two parts code that must be entered in the phone, the carrier asks to the manufacturer company the code, when they generate the code you just enter it and the other bands are unlocked then, same applies for those 3g or 3.5g modems
some carriers charge you for this process, others do it for free and as tschomer said, others give the phones without any lock system
the lock phone was made to avoid people leaving the company, you ended as a hostage, now the companies have to offer you good prices and good service to make you stay
i once heard that they locked the phones to avoid stolen phones to be used on another carrier but in most countries this never worked, unlock a phone illegally seems to be very easy so they have to do now is create a database with every imei on every phone sold or in use and if the owner reports a stolen phone, that imei ends locked on all carriers
recently, some smart people are stealing those phones and taking them to another country, where the imei has not been reported as stolen, so it can be activated without problems so the idea now is report the imei of each phone in a global database to stop this, if the phone is reported as stolen in us, it can't be used in another country and viceversa