Apple tried to make it illegal
Kind of. They have some issues with the copyright of the software, but the EFF, Electrictronic Freedom Foundation and some sofware makers like Skype and so on are opposing it. Nothing definitive on that yet, and I think it unlikely that a hardware maker can limit how that hardware is used. As was stated above, it is not a resolved issue.
Originally Posted by PocketAces21
If you jailbreak, you only void your warranty IF Apple can prove that the jailbreak is the reason your phone becomes inoperable. A button falling off of a jailbroken phone would not be out of warranty just because the phone is jailbroken.
Since you can always restore to factory settings, I think this is unlikely, although loading beta software and the like could brick your phone such that the average user can not restore it. Using a beta version of 3.0 before it was released might do it, but that issue is behind us. Running a jailbreak on 3GS however, could (I am guessing here) cause a failure that would be difficult for the average user to fix.
I did have a snotty Apple tech tell me that I had voided the warranty, but another one fixed my problem, which was a loose cable- no way a jailbreak causes that type of problem.