For an M104 engine, an independent would charge about $1,200-$1,400 for just the head gasket.
If you decide to have the head resurfaced and to replace the valve guide and valve seals, then you'll need to add an additional $300-$400.
I'm sure the dealer's price would be higher than this.
FWIW, the new head gaskets have steel inserts that prevent them from leaking again.
2001 E430, Bourdeaux Red, Oyster interior.
1973 280SE 4.5, 170,000 miles. 568 Signal Red, Black MB Tex. "The Red Baron".