Its actually not illegal. You made an exchange to apple money for an ipod. You have paid for it so legally the can not do anything ifyou decide to alter it. What is illegal isif you post the copyrighted code such as the operating system of the ipod online.
While its not illegal, Apple has tried to make it illegal several times to jailbrake the iPod, iPhone and iPad. Because when you buy a piece of iCrap you don't really own it - or that's at least what Apples attitude seems like.