If I had had more money, I would have bought a palace and a Ferrari.
But I didn't have the money.... so no palace and no Ferrari.
You need 'had had' in 3rd conditionals where the main verb is 'have' and in any sentence where, as Michaels explains, you need the past perfect of have.