For the lack of a better term, think of the FHA funding fee as a slush fund. Yes, I know it sounds crass, but as you read on, you will easily understand the FHA funding fee. In the State of Pennsylvania, we pay an uninsured/under insured fee on our aυto policy. The reason is because there are drivers who do not have autо insurance or are under insured. So we all chip in a little extra on our insurance premium to cover the unfortunate person who has an accident with one of these drivers.
The Federal Housing Administration (FHA) employs a similar concept with the FHA home loan. Each FHA loan applicant pays in cash at closing, or finances a "little extra" called the FHA funding fee. Now when a mortgage lender forecloses on an FHA loan, the mortgage company seeks repayment of the loss from this Funding Fee "slush fund", again for lack of a better term, but you get the point. The mortgage company is not totally indemnified, the lender is paid a percentage of the loss. After the mortgage company is paid off, the department of Housing and Development (HUD) takes ownership of the house and resells the house. These homes are commonly called HUD homes, or FHA foreclosures.
In addition to the FHA funding fee, the home buyer also pays a small premium each month as part of their mortgage payment. This fee is known as MIP  "mortgage insurance premium". See  MIP/PMI
Even if your FHA down payment is 20%, you will still incur the upfront funding fee and monthly insurance premium (MIP).
The Federal Housing Administration (FHA) loan program does not have a sales price limit, however, the Federal Housing Administration does set maximum loan amounts for each US county. The typical loan limit for a single family residence or condominium is $271,050, for two residential units (duplex), the loan limit is $347,000, three units, the limit is $419,425 and a four unit dwelling is $521,250. There are county exceptions.
Calculating the correct FHA loan amount can be a bit tricky, so I'll walk you through the calculations step by step. As stated in the previous paragraph, the typical county limit for a single family home (and "approved FHA condominium) is $271,050. Working backwards, the maximum sales price would be approximately $280,880.
The minimum down payment percentage for an FHA loan is 3.50% (currently)
FHA FUNDING FEE CALCULATION (1)  

Effective June11, 2012  Column 1  Column 2  Column 3 
Sales Price  $200,000  
X Down Payment Percentage  3.50% (minimum)  
= Down Payment  $ 7,000  
Subtract the down payment from the sales price to arrive at the "base mortgage". The FHA funding fee and monthly mip is based on the "base mortgage". 

Column 1  
Sales price  $ 200,000  
Less down payment  $ 7,000  
Base mortgage =  $193,000  
Now multiply the base mortgage by the current FHA funding fee percentage (0.0175). 

Base mortgage =  $ 193,000  
X FHA funding fee percentage  0.0175  
Funding fee cost  $ 3,377.50  


Base mortgage =  $ 193,000.00  
+ Funding fee cost  $ 3,377.50  
= Total FHA mortgage  $ 196,377.50  < the principal & interest payment is based on this amount 
Looks pretty simple right? Simply multiply the sales price by the down payment percentage to arrive at the "base mortgage. Multiply the base mortgage by the funding fee percentage and add that cost to the base mortgage and you have the Fha mortgage that includes the funding fee. By the way, the principal and interest payment is based on the "full" mortgage (base loan and funding fee together). But if you recall, there are "maximum FHA loans amounts. So what if the sales price is $500,000 and the maximum loan amount is $271,050? Here's the calculation.
FHA FUNDING FEE CALCULATION (1)  

Effective June11, 2012  Column 1  Column 2  Column 3 
Sales Price  $200,000  $ 500,000  
X Down Payment Percentage  3.50% (minimum)  3.50% (minimum)  
= Down Payment  $ 7,000  $ 17,500  
Subtract the down payment from the sales price to arrive at the "base mortgage", but notice that after subtracting out the down payment in column 2, the loan amount exceeds the maximum fha loan limit. 

Column 1  Column 2  Maximum Fha Limit  
Sales price  $ 200,000  $ 500,000  
Less down payment  $ 7,000  $ 17,500  
Base mortgage =  $193,000  $ 482,500  $ 271,050 
In this case, $271,050. So we will substitute $ 482,500 with the maximum limit of $ 271,050. Now multiply the base mortgage by the current FHA funding fee percentage (0.0175). 

Base mortgage =  $ 193,000  $ 271,050  
X FHA funding fee percentage  0.0175  0.0175  
Funding fee cost  $ 3,377.50  $ 4,743.37  
The loan amount is the lesser of sales price less down payment
or the maximum Fha loan amount for the county that the home
is located in. And just a reminder, the loan amount increases
with the number of units. Notice how much more down payment
is required on Column 2. The reason of course is because the
loan limit for this calculation. FHA financing are ideal loans
up to and slightly over the loan limits, however, they can work
against the home buyer if the limit is exceed by a large amount. 

Column 1  Column 2  
Sales Price  $ 200,000.00  $ 500,000  
Less down payment (3.5%)  $ 7,000  $ 17,500  
= Base mortgage  $ 193,000  $ 271,050  
Funding fee  $ 3,377.50  $ 4,743.37  
Full mortgage  $ 196,377  $ 275,793  
Down Payment  $ 7,000  $ 228,950 
So where does the funding fee go?
Where does it go?  

You're mortgage is $ 196,377  The bank sends $ 3,377.50 to > > >  to HUD  FHA 
What is the monthly mortgage insurance on an FHA loan?
The monthly mortgage insurance premium has become a little more difficult with the April, 1, 2013 change. The insurance percentage will be determined by the "base" loan amount, down payment percentage and loan term (i.e 30 or 15 years)
The first step in calculating the monthly MIP is to determine the loan amount. If the loan amount is less than or equal to $625,000 (and a term of 30 Years), focus on numbers 1. and 2. If the down payment is the minimum FHA percentage of 3.5% or up to 5% down, use row "1.". If the down payment is greater than 5% and less than $615,000, use the annual mip premium listed on line 2.
30 Year Mortgage  

Base Loan Amount  Down Payment Percentage  Effective  Annual MIP  
1.  ≤ $625,500  Less than, and equal to 5% down payment (≤ 95.00%)  4/1/2013  1.30% 
2.  ≤ $625,500  Greater than 5% down payment (> 95.00%)  4/1/2013  1.35% 
3.  > $625,500  Less than, and equal to 5% down payment (≤ 95.00%)  4/1/2013  1.50% 
4.  > $625,500  Greater than 5% down payment (> 95.00%)  4/1/2013  1.55% 
Up until June 3, 2013, the following chart lists the FHA monthly mortgage insurance percentage for FHA loans with loan terms of 15 years or less. On June 3, 2013, HUD/FHA will utilize a revised 15 year (and less) monthly fee calculation. ML 20124.pdf)
Term ≤ 15 Years with Loan to Value above 78%  

Base Loan Amount  Down Payment Percentage (Loan to Value)  Effective  Annual MIP  
1.a  ≤ $625,500  78.01%  90.00%  4/1/2013  0.45% 
2.b  ≤ $625,500  > 90.00%  4/1/2013  0.70% 
3.c  > $625,500  78.01%  90.00%  4/1/2013  0.70% 
4.c  > $625,500  > 90.00%  4/1/2013  0.95% 
Let's calculate the monthly mortgage insurance premium for a 30 year
FHA loan. Using the example above. The sales price is $100,000 and the
minimum down payment is 3.5%, that means FHA requires a 1.35% annual
premium  number 2.
If the down payment was greater than 5%, the annual premium would be
1.30%  number 1.
If the loan amount is greater than $625,000, use either number 3. or 4. based on the down payment percentage.
30 Year Fha monthly mortgage insurance example  

Sales price  $ 200,000  
Less down payment  $ 7,000  
Base mortgage =  $ 193,000  
Base mortgage  Monthly MIP Percentage  Annual MIP Cost  Divided by 12 months  Monthly Cost  
$ 193,000  X  1.35%  =  $ 2,605.50  / =  $ 217.12 
You can use the FHA loan calculator to estimate the upfront funding
fee and monthly mip
 Proceed to the FHA
calculator.
The FHA page explains mip cancelation.