Yeah, it seems a bit random, sometimes they seem to survive in their original jpg or png state, most times they seem to convert behind the scenes - covert converting 🤷 if you ever discover the secret, do drop a reply here.
Interestingly, when I edit a published story, even after publication, the images are still in their original format, size, and type. So something happens to them as they are disseminated - a colleague thinks it may be Chrome that does it, so Medium may be innocent...