While it might not literally be stashed under your mattress, "mattress money" is a catchall term to describe money saved without a documented paper trail. The money could come from selling a car, a small inheritance, or an outright gift. You could assume that cash is cash, but when it comes to real estate transactions it's important to understand that the way you save money is as important as having it in the first place.
One of the most important things lenders look at when evaluating a home loan application is how much money is available for the transaction. You need to be able to prove you will be able to cover the down payment and the closing costs. This verification is done by reviewing recent copies of bank statements, and if your savings account is short by $5,000 you can't simply deposit your mattress money into your bank account right then to cover the gap.
Lenders must be able to verify the source of the money you're using for the sale. If you've been saving cash at home and plan to use those funds to buy real estate in the future, take the money out of your "mattress" and deposit it into your bank account ahead of time. This will let the funds "season" - i.e. sit in your bank account for a few months. Remember, there is no universal guideline - funds should generally be "sourced and seasoned" for at least 60 days or two bank statement cycles.