I don't know all the maths behind it, but try saving a JPG, close it, open it, save it again, repeat a few times. You'll see quality degrade every time you close it. My guess is that the lossy compressors try their best to preserve the previous compression artifacts, but in doing so they introduce more compression artifacts.