The hotlinked image has this CSS:
.d-editor-preview img {
padding-bottom: 1.4em;
}
Whereas the uploaded image has this one:
.d-editor-preview .image-wrapper img {
padding-bottom: 0;
}
It also happens when the remote image has been downloaded to Discourse, because no dimensions are set in this case, which means no image-wrapper is created in the preview:
Remote image downloaded:

Uploaded image:
