It’s legal. Jailbreaking your iPhone is considered “fair use.” Nate Anderson in ArsTechnica on a ruling by The Register of Copyrights:
On balance, the Register concludes that when one jailbreaks a smartphone in order to make the operating system on that phone interoperable with an independently created application that has not been approved by the maker of the smartphone or the maker of its operating system, the modifications that are made purely for the purpose of such interoperability are fair uses.
Put another way, who cares? Jailbreaking an iPhone is an extremely uncommon practice utilized by the geekier side of gadget users to do more than Apple wants users to do. It’s not like jailbreaking sent anyone to, you know, jail.