The affordability calculation is fairly complex when done correctly, and some approaches oversimplify it. The calculation also involves a number of assumptions that affect the answer.
To do it properly, affordability must be calculated three times using three different rules. I call these the "income rule", the "debt rule", and the "cash rule." The final figure is the lowest of the three. When affordability is measured on the back of an envelope, which real estate brokers often do, usually it is based on the income rule alone, ignoring the other two. This can result in error.
The income rule says that the borrower's monthly housing expense (MHE), which is the sum of the mortgage payment, property taxes and home-owner insurance premium, cannot exceed a percentage of the borrower's income specified by the lender. If this maximum is 28%, for example, and John Smith's income is $4000, MHE cannot exceed $1120. If taxes and insurance are $200, the maximum mortgage payment is $920. At 7% and 30 years, this payment will support a loan of $138,282. Assuming a 5% down payment, this implies a sale price of $145,561. This is the maximum sale price for Smith using the income rule.
The debt rule says that the borrower's total housing expense (THE), which is the sum of the MHE plus monthly payments on existing debt, cannot exceed a percentage of the borrower's income specified by the lender. If this maximum is 36%, for example, the THE for Smith cannot exceed $1440. If taxes and insurance are $200 while existing debt service is $240, the maximum mortgage payment is $1000. At 7% and 30 years, this payment will support a loan of $150,308. Assuming a 5% down payment, this implies a sale price of $158,218. This is the maximum sale price for Smith using the debt rule.
The required cash rule says that the borrower must have cash sufficient to meet the down payment requirement plus other settlement costs. If Smith has $12,000 and the sum of the down payment requirement and other settlement costs are 10% of sale price, then the maximum sale price using the cash rule is $120,000. Since this is the lowest of the three maximums, it is the affordability estimate for Smith.
When the cash rule sets the limit on the maximum sale price, as in the case above, the borrower is said to be cash constrained. Affordability of a cash constrained borrower can be raised by a reduction in the down payment requirement, a reduction in settlement costs, or access to an additional source of down payment -- a parent, for example.
When the income rule sets the limit on the maximum sale price, the borrower is said to be income constrained. Affordability of an income constrained borrower can be raised by a reduction in the maximum MHE ratio, or access to additional income -- sending a spouse out to work, for example.
When the debt rule sets the limit on the maximum sale price, the borrower is said to be debt constrained. The affordability of a debt constrained borrower (but not that of a cash constrained or income constrained borrower) can be increased by repaying debt.
Affordability can be overestimated if one of the three rules is ignored and it turns out to be the one generating the lowest maximum price. The affordability estimate will also be affected by changes in the assumed maximum MHE and THE ratios, which vary from loan program to program and can also vary with other characteristics of the loan such as the down payment. Affordability may also be affected by changes in the assumptions made regarding settlement costs, taxes and insurance, interest rate and term.
You can see how any or all of these factors affect the amount you can afford using my calculator 5a on Housing Affordability.