Isn't AT&T required by law to unlock iPhones where the contract has run out? I know that Apple handles the unlock code, but the phone is no longer exclusive and that was the whole argument why the iPhone was the only phone on AT&T that couldn't be unlocked by the carrier.
http://www.zdnet.com/blog/apple/at-ts-policy-on-unlocking-phones/903
http://www.zdnet.com/blog/apple/at-ts-policy-on-unlocking-phones/903