Wikipedia has a great page on SIM locks, covering "Types of SIM locks, "Laws on SIM locking" and "Unlocking technology".
Looks like the iPhone has a service provider lock (SP-lock) to AT&T that:
[...] ensures that the handset is only used with SIM cards for the same service provider that marketed the handset
Bad news Apple chose AT&T:
However, some providers, including the former AT&T Wireless, never unlock handsets, even after a customer has fulfilled their service contract.