While jailbreaking an iPhone is legal in the US, Apple has always clearly stood against it, warning that it may void your warranty. You can’t criticize Apple for this policy because it makes lots of sense. Why would they try to fix an issue if the device is running unauthorized code on it, right?
Making unauthorized modifications to the software on an iPhone violates the iPhone software license agreement. The common term for modifying an iPhone is jail-breaking, with a particular emphasis on the second part of that term. That’s why we strongly, almost emphatically, recommend that you do not do so. Really. Should you be unable to use your iPhone due to an unauthorized software modification, its repair will not be covered under the warranty.
I particularly like the punctuation around “really.”
This being said, if you ever have a software problem with a jailbroken iOS device and you want to take it to Apple for warranty service, you should always make sure you restore your device first, for two reasons.
First, they will definitely ask you to restore your device and set it up as a new phone. Don’t try to fool them because they can tell very quickly and easily when the device was last restored and if it has been restored as a new phone or from backup. Once you restore your device, there is absolutely no possible way for anyone to tell your iPhone was ever jailbroken.
Second, if they find out the device is jailbroken, and they will if it indeed is, they will refuse to service it.
Hardware problems that are obviously not linked to a software issue (ie. a broken Home button) might not require a restore, but some geniuses may or may not check for a jailbreak and service the device at their own discretion. Your mileage may often vary on that part.