Starting January 26, 2013 unlocking cell phone without carrier authorization is illegal under DMCA in the United States. Any handsets purchased before this day can still be unlocked without violating DMCA.
T-Mobile released a statement regarding the issue.
T-Mobile recommends customers contact the device manufacturer or AT&T directly to request the unlock code for their device. Customers would then purchase a SIM card, select a T-Mobile SIM card only Value plan that suits their needs and T-Mobile will help the customer configure their device for its network. T-Mobile offers step-by-step instructions at retail and on the T-Mobile customer support forums online.