The assessment is for use to calculate property taxes and it not a good indicator of the homes market value.
You receive money based on the lower of: (1) contract price, or (2) appraised price. In most cases, where the appraisal comes back at or above the contract price, you receive x% of the contract price.
For example: You agree to buy a house for $100,000. The appraisal comes back at $100,000. If you've agreed to put 20% down, the bank will lend you 80% of the sales price, or $80,000. If you're using an FHA program, you're required to put 3.5% down. So the bank would lend you 96.5% of the contract price, or $96,500.
If the appraisal comes back lower--say $90,000--then the bank would lend you 80% of $90,000, or $72,000. Hopefully, you would have had an appraisal or financing contingency in your contract and therefore might be able to renegotiate the contract or get out of it. Otherwise, if you still wanted to pay $100,000 for it and the bank agreed to lend you $72,000, you'd now have to come up with $28,000 as a downpayment.
You cannot take out a mortgage for $40,000 on a house that you'd buy for $25,000. The bank wouldn't lend you the money. It'd lend 80% (or 96.5%, or whatever) of the $25,000. However, there is an exception. It's called a 203(k) loan, in which you're lent the money based on the fixed-up value of the property. However, there are a number of strings attached--money has to be held in escrow, work has to be done by licensed contractors, etc. But that may be what you're looking for. Check with a good mortgage broker.
As has already been pointed out, assessed value is absolutely meaningless. It's used for tax purposes, not to determine the value of a home. Where I live (Fairfax County, Virginia), the tax assessor's office admits that it considers an assessment accurate if its accuracy is in the low 90% range. That means a property with a true, honest, market value of $100,000 could be assessed anywhere between $92,000 and $109,000 (approximately) and still be considered accurate. You tell me: How would you feel about spending $100,000 on a house, based on its assessment, and find out it's only worth $92,000? And that's with what the county considers an ACCURATE assessment.
Hope that helps.
But if you are looking to do reno work on the house, I would look into what is called a 203k renovation loan. So if you buy for $25k and it needs that $15k in reno work and will appraise for $40k after repairs, than this really is one of the better options out there.
Just check to see if it qualifies with a lender as I dont know if there is a minimum loan amount. Dont know if there would be but always good to talk to a mortgage professional.