JPEG was specifically created to a be royalty-free standard. JPEG 2000 is the more advanced format with patent royalties that no-one uses on the web for that very reason.
No it wasn't. There was arithmetic encoding option, which was owned and patented by IBM and was not royalty-free. As result everyone implementing codecs had to stick with less efficient, but free Huffman encoding.
Baseline profile JPEG was specifically created to be a royalty-free standard. JPEG-arithmetic is the more advanced optional extension to the format with patent royalties that no-one uses on the web for that very reason.
(Though to be fair to IBM, though the situation appears vaguer than I'd like, it seems they were happy to licence their patents royalty-free, but other companies that also held patents weren't: http://en.wikipedia.org/wiki/Arithmetic_coding#US_patents_on...)