What it's doing is not discarding pixels, but the extra RAW sensor data for each pixel after the compression... the MP size is still the same. My files on JPEG FINE are an average of 4.5 to 5 MB, but if you multiply photo size of 4288x2848, you still get 12.2 MP.
What is the "extra RAW sensor data"?
RAW data encompasses more than just the dynamic range you see with your eyes.
Ever here of shooting to the right? It's when you meter a scene slightly over exposed when shooting RAW. Why do that? Because in post when adjusting the exposure of the RAW file, you can bring it down and some of those ares that may appear to be slightly over exposed or blow out will reveal a perfect exposure, giving you a greater overall dynamic range in your final shot.
If you would have shot in JPEG, you would have lost what ever appears to be blown out.
Plus there's the file medium. RAW is the uncompressed original data that the sensor transfers to the memory card. JPEG adds compression based on what quality you choose in the camera and it also adds any contrast, sharpnening, and saturation settings in your camera to the photo copied to the memory card.
Also, iirc, RAW is completely lossless file type. You can save a RAW file one thousand times and it won't degrade in quality. If you save a JPEG file over and over again, after so many times, the compression from the file type will start to cause artifacts and image degridation.
I'm not saying that it's wrong to shoot JPEG as there are advantages to using that file type. You use what you need.