A salvage yard engine with reasonably low mileage will cost 1,400 - 2,000 & most shops will charge about the same to do the swap so yes , you could very likely have around 4,000 in an engine replacement .
Add the other needed repairs & what you paid for it & you're getting a lot of money in this...