In the US, it is 100% legal to unlock your phone no matters if it is iPhone or any other phone. In case of iPhone, you have to jailbreak it first to get it unlocked. So the question is Jailbreaking iPhone is Legal? And the answer is Yes, Jailbreaking is legal however, you technically “void” your warranty. In US laws are very strict for consumers rights. If you jailbreak, you only void your warranty if Apple can prove that the jailbreak is the reason that spoiled your phone (rare case jailbreaking damages your iPhone) only then they can cancel your warranty. A button falling off of a jailbroken phone would not be out of warranty just because the phone is jailbroken. Still if you need to virginize your iPhone before getting your warranty you can always restore to factory settings.
Hacking the iPhone/iPod Touch is not illegal. While Apple would like to make you think it is illegal, it is not. It is impossible to get in any legal trouble for hacking iPhone/iPod Touch . You and Apple made an exchange. You gave Apple money they asked and they gave you an iPhone/iPod. It is officially yours and you can do whatever you want with it.Because it is yours now, you bought it, you have the right to do whatever..But I do believe downloading cracked applications is the illegal bit.
Recently Apple has filed comments with the US Copyright Office stating that the act of jailbreaking your iPhone is a copyright. In Support to Jailbreak community and answer to Apple EFF responds, in turn, that “reverse engineering is a fair use when done for purposes of fostering interoperability with independently created software,” saying that yes, even though jailbreakers are using Apple’s copyrighted code, they are doing so in a way that allows them functionality that Apple doesn’t provide access to on their own.
Conclusion : Jailbreaking and Unlocking are not illegal. We are not encouraging you to jailbreak your iPhone/iPod. We are just clearing some myths about jailbreaking and unlocking. If you buy an iPhone/iPod, it should be your right to “get under the hood,” as they say, and do what you want. Personally i m using both Unlocking and Jailbreaking my iPhones but i never used cracked applications. But And keep in your mind we are not lawyers. ) In near future it seems Apple may be able to try and make a case against anyone offering software that does modify or otherwise “misuse” their copyrighted code. But that is future not the present.