Short answer: YES, you can do exactly what the Property Brothers do on HGTV and more (my wife loves that show).
As stated below, you can use the FHA 203(k) or the Fannie Mae HomeStyle Renovation loan to complete a large project like this. There are pros and cons of going with one over the other but both are essentially the same loan except one is a FHA loan and the other is a conventional loan. As Daniel said, your max loan amount for the 203k in your county is $303,750 and for the HomeStyle version, the max loan amount is $417,000 (this example assumes a single family residence, the loan limits are much higher for 2/3/4 flats).
A rehab loan (203k streamline / 203k full / Fannie Mae HomeStyle) can be used on a purchase to rehabilitate your home as desired (needed and/or desired repairs, even if the house is already in habitable shape) or or a refinance to update your home as you see fit. The HomeStyle as mentioned earlier can also be used on second homes and investment properties. Both programs can lend on one to four flat properties. FHA's 203k is pretty strict on eligible condo rehabs whereas the HomeStyle option is superior for units in the city that need rehabbing (or any condo for that matter). For anyone unfamiliar with the program, please read this sentence carefully, REPAIR WORK DOESN'T NEED TO BE DONE BEFORE CLOSING, I say this in caps because there are so many consumers out there who assume all work must be done before closing and I wanted to address that rumor right away. All work is done AFTER closing by your contractor. Having said that, here's where anyone with knowledge on the topic will offer a retort saying FHA allows for borrowers to do their own work... The reality is that even though FHA allows it, there isn't a lender in the country that'll allow you to do your own rehab. The foreclosure rate on "self helf" transactions is a staggering percentage and any lender who's offering this program knows this as well. While it's true that on an exception basis, underwriters have been known to let a borrower paint or do some very minor things, it's the exception and not the rule. If you're looking to do all of your repair work yourself, financed rehabs like what we're talking about aren't for you.
You could use a 203k to gut your house and re-build it (a portion of the foundation must stay in tact) but as one of the other contributors said, you may want to consider other homes if you're doing that major of a rehab.
Whether you're doing a streamline 203k, full 203k or HomeStyle, the process is essentially the same, talk to a contractor (or multiple) to get an idea of what the cost will be and if you can afford it (you'll want to speak with a loan officer to make sure you can even get a large enough loan to cover your existing balance/purchase price + desired repairs). In cases where there is structural work (replacing a roof is NOT considered structural) which includes moving/modifying a load bearing wall or repairing the foundation would most certainly be a structural change and would require the guidance of an outside consultant tasked with overseeing the project and ensuring it's completed as expected by the investor (Fannie Mae or Ginnie Mae) as they have no other way to determine if the work was done properly or at all post-close, hence why the (HUD) consultant is so important to them and why they're required on larger jobs or complex/structural rehabs. This consultant will also ensure the contractor's bid isn't unreasonable and can if he chooses, use lower cost numbers for the job than the contractor used and the contrator MUST lower his prices to match the consultant's estimate to continue working in the program. You could look at your consultant as a sort of fairy god mother, they'll make sure you're not getting overcharged and the work they're telling you they'll do is feasible for what you want done to your house.
To the person below who said their loan specialist said these are more for cosmetic work, that's what lenders who can only do the streamline 203k tell you so they don't have to admit they can't close your client's loan that want larger rehabs than the streamline will allow or structural changes. When I worked at a lender (name withheld) in the past as a specialist, I heard co-workers around me who could only do streamline 203k's use this speel all the time, it was almost comical to hear, please don't be fooled by the salesmanship, you've done your research if you're reading this, you're a step ahead of most others. Your loan officer should be intimately familiar with the program and be able to offer you the full gambit of renovation options. The most knowledgeable Renovation Specialists work for lenders who cater to these products.
I'm out of space here, if you'd like additional information, feel free to add more comments here for responses or email me directly.
I hope you found this "article" helpful, have a great day!