Costs to replace a head gasket, assuming the head is in good condition, not warped, and doesn't need a head job typically costs between $600-$1000. More if the heads need to be machined, if valves have been damaged and need to be replaced, etc.
A rebuilt engine typically costs around $2000, and a few hundred to install.