Go into the castle and find Proventus Avenicci. For this glitch to work, you need to make sure he's by something you can store items in. (his bedroom has a wardrobe that's perfect for this glitch) Make sure you have 5000 gold and talk to him about buying the house. Select the answer "I'll take it" and immediately press "O" to back out of the conversation. Then quickly open up the wardrobe and store all your gold in it. You'll receive the key to the house, and then you can retrieve all your gold from the wardrobe.