How long is a piece of string? An extension can be as expensive as you like.
The advantage of building an extra floor is that you don't have to take up yard space... The downside is that you get a staircase inside the house. It can be difficult in old age.
Then it can get a bit complicated to build upwards when you remove the roof, transport building materials up, install new heating pipes, electricity, ventilation, possibly reinforce the framework, etc., etc., etc.
The possibilities are many, and problems are solved as they come along.
P.S. We have built an extra floor - see the website below: