My wife is extremely attached to this particular house, so I don't really want to walk away if I can help it. If it were just me, my attitude would be to let it be somebody else's problem. But it would do a lot for my marriage if I can salvage this transaction.
Once you're emotionally invested in a purchase, you have lost all your negotiating power. This problem is someone else's headache, but you can choose to turn it into your advantage or to walk away.
I remember my first house purchase attempt. My wife was 3 months pregnant with our first child and we were anxious to buy. I was 28 and our savings rate was about 80% - I was making a lot as a new business owner and our expenses were ridiculously low. (Ah, if I had it to do over again - I made lots of mistakes after that!)
We put in an offer on a great little house that was used as a weekender home for a couple that didn't use it much anymore. Lots of new upgrades and overimproved for the area, motivated seller, and we were getting a great deal. But the property had a buried oil tank (this was common in the 70s and 80s) and the bank wouldn't give a mortgage until the oil tank was relocated above-ground. We had 20% down but not enough to buy it outright.
So they hire a guy to do this work. He installed a new oil tank aboveground, pumped out all the old oil and filled the old tank with sand. Except, he did a crap job and the legs of the new tank were just put on the soft grass under the gutter downspout, no gravel underlayment or cement or anything! Predictably, after the first rain, the tank legs sank into the ground and spilled 220 gallons of #2 fuel oil (aka diesel) right over the well.
I get a call from the agent on the day of the walkthrough that they had "a small problem." You could smell the fuel oil from a half mile up the road. I walked inside, got a glass of water out of the tap, and saw a rainbow oil pattern on the surface. I just canceled the deal and walked away, and saved myself a lot of trouble. Fortunately, Mrs Axecleaver supported my decision, and while she was sad about losing the house, she didn't want to buy a headache, either.
So, easiest solution is to walk away, knowing that there will be other houses for sale and other deals you can make. The other way you could go with this, is to get some estimates from a plumber for a "worst case scenario." Get at least two or three estimates. Take this price off the purchase price, and ask them to kick it in for you at closing to lower your out of pocket costs. Be willing to walk away if you don't get it. This way, you're buying a problem but if things work out in your favor, you stand to come out ahead.
Good luck and let us know how it works out.