you are assuming Mac and Dell are using the exact same parts but just assembled in different boxes. let me explain
1) For commodity parts like CPU, HD, Memory, video cards etc, even though they appear to used the same parts on paper, in mass manufacturing, everything comes out on a bell curve. Which company do you think pays or is willing to pay a premium to obtain the higher end of the bell curve? Apple requires a much tighter incoming spec than their competitors. I am sure if you swap out all these parts and replace them on your own with parts from Newegg, chances are it will work fine, but it's a mass statistical game. Why was apple rated way higher in customer satisfaction than Dell?
2)for non-commodity parts like display, keyboard, trackpad, housing- every single Apple made item has been an engineering feat- ask around. For example, why do most graphic design industries uses Macs? The color matching/gamut and color rendering on Mac displays is simply better. If you pry a Mac apart you'll find "oh, but they use 'Samsung' display (for example), same as what I can buy at best buys". wrong.
3) the better car analogy is probably compare a Lexus to Toyota. Lexus uses lots of the "same" Toyota parts but internally the higher quality parts inevitably goes to Lexus.