There are several factors:
1) Dell buys its components in much larger volumes and uses its considerable market muscle to squeeze its suppliers for lower costs.
2) HP tends to engineer/design their own computers to a greater extent than Dell, who tends to stick to standard components (whenever possible) and whose designs are frequently based on oft-used templates. This one helps reason #1, above, because Dell could buy much larger volumes of, say, a given video card if most of its desktop models include that card. HP might have much more product differentiation in their computer lines and may lose the volume pricing advantage there.
3) Warranty and tech support differences, as well as the difference in quality of these. For instance, you would pay more for an HP if they have more US-based call centers than Dell or better-trained support personnel.
4) Uniqueness. For instance, one of the reasons I like to buy Apple and IBM laptops is that they are somewhat rare. Everybody's got a Dell. HP's aren't exactly sexy, but they are a bit rarer than Dells. Some people are willing to pay a premium for, say, glowing red lights (Dell XPS laptops) all over their machines.