NO. You could be buying a can of worms even if the home is perfect. The biggest risk is an angry former owner. There is also the risk that if the owner didn't pay his mortgage, maybe he didn't pay his IRS or State taxes either. The government could seize the home after you bought it and put money into fixing it up.
What you need to look at, is the home a really good buy? Are you protected from the risks?
Some homes are in foreclosure because the home lost value. So if the home bought for $100,000 and the mortgage was for $80,000 and you buy it for $80,0000, you better make sure the home is still worth $100,000. It might only be worth $70,000 now.
Other homes are in foreclosure because the owner had medical problems or lost a job. They may have bought the house for $100,000 and only owe $80,0000. They'll sell it to you for $80,000 to save their credit worthiness and integrity even though the home might be worth $110,000 now. That would be a really good buy. You need to look at each situation carefully.