When applying for a mortgage, and have it swiftly approved by the lender, one generally has to make a 20% down payment, afford closing costs, and have favorable credit scores and financial ratios. 20% down payment mortgages are known as conventional mortgages, and are often quickly sold to other lenders in what is known as the secondary market. Mortgages are actually bought and sold almost like stocks or bonds (they can also be bundled into assets known as Mortgage Backed Securities, which got highly inflated in value and precipitated the 2008 banking crisis).
If you do not have the 20% down payment, there are many lender promotions such as first time home buyer programs, 5% or 10% down payment programs, Fannie Mae foreclosed-properties, Veterans Administration loans, and HUD loans available. Such mortgages are known as unconventional mortgages, and are classified internally by the lender with labels such as sub-prime and Alt-A according to risk.
After the recent banking crisis, banks greatly tightened their lending standards, and unconventional mortgages became more difficult to attain. In general, if you do not have a 20% down payment, save as much money as you can for a down payment, keep your credit scores as high as possible, and then apply for a first time home buyers program.
Also, a 401k plan is a risky way of saving if you do not have a 20% down payment. One can borrow against it, age the money, and then use the proceeds for a down payment eventually (borrowed money used for a down payment is usually disclosed by the borrower on the mortgage application as a checkbox or declaration). Always remember that if you lose your job and have an outstanding 401k loan, the balance is due immediately or it is considered a taxable distribution.
Because of the banking crisis, the government may also have temporary beneficial tax rules for first-time home buyers that should be investigated if you do not have 20% in cash (tax credits, IRA or 401k one-time withdrawals for a down payment).
Related, you may be able to get the seller to pay closing costs to reduce up front cash if you are buying a home for the first time. Always seek the advise of a financial planner of course, and read all the Financial Considerations pages in Buyer Tools.