You do, actually, pay more for "density". Moving things closer together, incurs extra costs (Even ignoring all other factors). Building codes have to be stricter (for equivalent safety levels), when buildings are closer together. Walls and insulation need more expensive materials (for equivalent sound dampening levels), when buildings are closer together. Insurance rates get higher (for equivalent coverage), when units are closer together. Labor costs are higher and labor time needed is higher (for equivalent results), and so on.
A few costs go down (less length of pipe material, or less length of wire, etc). But those minor material costs are usually far out-shadowed by the increases in labor to accomplish them (it costs less money to replace all shared water pipe in my 20 house suburban street, than it costs to replace all shared water pipe in a NYC mid-level with 20 units, even though the literal length of pipe material might be cheaper). It costs more to remodel a bathroom in Manhattan than in (say) Louisville, KY., even for identical bathrooms with identical fixtures and identical sqft.
Denser usually means more complexity or more labour, both things that cost extra money.
---
Density advocates generally acknowledge this, density fundamentally costs more. Their argument usually rests on cities having hyper-overvalued properties -- the argument is that the extra cost of density is cheaper than the extra cost of land, and that's how they manage to make density look like a cost savings. Which kind-of works in major cities downtowns, but doesn't really pencil out elsewhere.