Rick Felix paid $200,000 for a four-bedroom, split-level foreclosed house in Ambler. He made the payment in cash without any option to inspect or even get a good look inside the place beforehand.

When he did get in, the roof was rotting, the septic tank was failing, the pool was green with algae, and the place needed to be gutted.

He couldn't believe his luck.

Beneath all that neglect, Felix, 34, saw a starter home for him and his fiancee.

"It's a desirable area, in a great school district, a great piece of land. As far as real estate goes, it was mind-boggling to everyone that this house hadn't been picked up yet," Felix said. "Honestly, when I saw it pop up when it did, it was a godsend."

The couple, who bought the house with the help of a Realtor once it hit the market, are looking at three months and upward of $100,000 in renovations. They count themselves among the savvy homeowners who have successfully navigated the complex and high-risk, high-reward world of buying a foreclosed house.

If home owners fail to pay their mortgage and can't pay off outstanding debt, or arrange with the bank to sell the property at a loss, the home goes into mortgage foreclosure. The process from unpaid mortgage to auction can take more than a year, during which owners often don't maintain the property. If a home doesn't sell at auction, the lender, usually a bank, assumes the property and puts it on the market.

In Philadelphia, about 528 foreclosures will go to sheriff's sale in September, and about 2,133 bank-owned houses in Pennsylvania and New Jersey are on the multiple listing services database. Nationally, there were 933,000 foreclosures in 2016, a 10-year low.

Pennsylvania ranked 12th in foreclosures as of August 2017, according to ATTOM Data Solutions, a firm that tracks foreclosures, with one of  about every 2,000 homes foreclosed. New Jersey ranked first with one of every 663 homes foreclosed.

With a shortage of housing stock  in the Philadelphia region, more people are looking into foreclosures, real estate agents say. But buyer beware: Sometimes a good deal is actually too good to be true. And a novice looking to buy can get beat out by investors who come with cash in hand and make a business out of buying and flipping distressed homes.

"When someone says, 'I want to buy a foreclosure,' I say, 'So does everyone else,' " said Orlando Martinez, a Philadelphia-based real estate agent who frequently sells foreclosed houses. "Everyone wants to buy a foreclosure because they assume it's the best deal. It's not necessarily the case."

Before turning to foreclosures, Martinez encourages his clients to look at auctions, properties that have been on the market for a while, or short sales, in which the bank agrees to accept less than what the homeowners owe on their mortgage. Foreclosures, he said, get a lot of exposure and can be very competitive.

Look to buy a foreclosed home, real estate agents interviewed said, only if you have cash on hand, construction know-how, or a contractor to work with, and a flexible timeline for moving in.

Mortgage companies typically want proof that someone buying a foreclosed house has the means not only to pay the mortgage but also to fix up the house, because the houses are rarely move-in ready.

Banks tend to accept the offer with the fewest contingencies and will often go with the bidder who waives a contingency period and home inspection. Cash offers are also preferred.

"I would say to anybody who's looking to purchase, don't rush anything, don't be impulsive, educate yourself, try to get as much history on the property as you can beforehand," Martinez said. "Always make sure the value is in the point of purchase, not what you plan on building into the property. Never purchase something off the expectations. Purchase it for what it is because what it is is what you get."

Before foreclosures go on the real estate market, they're put up for bid at sheriff's sale.

The number of people bidding at those sales has increased substantially in recent years, Inspector Marquet Parsons of the Philadelphia Sheriff's Office said. Parsons didn't have exact numbers but said he's seen bigger crowds, and the office had to add a second monthly informational class for those interesting in buying at sheriff's sales.

While investors and developers come from all over the country, about 75 percent of those who bid at the sales are families looking for a cheap starter home, Parsons said.

The winning bidder needs a minimum of 10 percent of the sale price and has only 30 days to pay the balance or forfeit that deposit.

Parsons sees people with excellent credit make the mistake of bidding on a property and putting down a deposit, only to find out they can't get a bank loan because banks typically require inspections and appraisals.

Whether they are buying a foreclosed house at sheriff's sale or through a real estate agent, Parsons tells prospective buyers to find out as much as possible about the property without knocking on the door or trying to go inside. Look at  licenses and inspections records, and check the zoning regulations if the property is going to be used for something other than a residence.

Realtor Michael Cohen, who represents banks during foreclosure sales and sells about 100 a year, doesn't recommend that novices go straight to sheriff's sales. Only a small number of homes sell each month, so buyers can usually get a shot at them once they go on the market.

"It's too high risk. It's like going to Atlantic City," Cohen said. "It's a hard gamble because you really can't see what you're buying. It's really for the advanced investor."

And if you're eager to move in, buying a foreclosure is probably not a wise move.

In addition to the time it takes to complete renovations, there is a small chance that the former tenants — or squatters — refuse to leave even after the deed has been transferred.

There's no "do-it-yourself" eviction in Philadelphia. In fact, an illegal lockout can cost a person $300 for every day the squatter is locked out of the property. Eviction proceedings in court can take four to six months — or longer if the tenant appeals.

Felix estimates that repairs of the Ambler house will cost around $100,000, but he owns a remodeling business and his fiancee, Amber Verazin, is an interior designer, so they will save a lot on labor costs.

If Felix can entirely upgrade the house, he thinks it will be worth about $425,000 — $125,000 above what he paid and what he thinks he'll spend on repairs. The median home price in the neighborhood, located in the highly rated Upper Dublin School District, is $347,000.

The couple closed on the house earlier this month and hope to get renovations done ahead of their December wedding.

"As soon as I get the permits," Felix said, "the work starts."