Decompressing and recompressing a zip gives a lossless copy of the actual
data, but there's no way to reconstruct the same exact zip you started with.
The same thing can be done with image data. For something like jpeg you can keep the coefficients but store them in a more compact form.
For what it's worth JPEG XL claims that it's 'reversible', but I'm not sure if that means you get your original jpeg back, byte for byte, or you get an equivalent jpeg back.