Upscaling doesn't happen during the encoding process >_>, it happens during the decoding process.
And an upscaled picture can ( and most times does) look better because most of the time it goes through motion compensation, noise reduction and image sharpness enhancement.