In order to buy the house in Whiterun, you'll need 5000 coins on hand, but you'll be able to keep it with this trick -- which makes use of your ability to turn your head around while talking to people.
If you go to the man who sells you the house in Whiterun while he's asleep in his bed, he'll sit up to talk to you. Make sure you're standing in a place that you can open the nightstand or dresser next to the bed while you're talking to him. As soon as you agree to buy the house *immediately* open the dresser next to the bed and put your gold into it and return to the conversation. He'll give you the key, and then you can just get your gold back out of the dresser, as rich as you were before.