It is usually cheaper to replace an engine than rebuild. The cost difference is due to the labor hours needed to rebuild. It is far more efficient in terms of labor to pull an engine and drop a replacement in place than it is to pull the engine, rebuild it, and reinstall.