In parshas Metzora we learn the rules of tzaraas which afflicts a house. Two reasons are given by the commentators for this that seem to contradict one another.
The first reason is the one that fits tzaraas generally - it afflicts a person as a result of certain sins such as loshon horo. In addition, tzaraas affects a persons house, we are told, in a special case where a person is asked by a neighbour for a certain item and denies owning it. As a result of his lie, tzaraas appears in his house and he is forced to clear everything out of it, including the item he denied having.
However, the other reason is a positive one. Rashi tells us that during the 40 years our ancestors wandered in the desert looking for that elusive penny someone dropped, the Canaanites hid their treasures in the walls of their homes in the hopes that if they were conquered they wouldn't lose their precious items. After settling in the land, tzaraas appeared in the walls and when the house was demolished, presto! The hidden treasures were discovered.
So in one perspective tzaraas is sent as an obvious punishment and in the other it's a reward?
I believe the common factor between both understandings is a person's love of materialism in this world. The mishnah in Avos tells us that a truly rich person is one who is content with what he has. Chazal also tell us that people who lust after money are never satisfied with what they have, always wanting more.
A person who desires money or social status will inevitably come to commit many of the sins that bring tzaraas on a person. According to Sifrei the house is affected first and one can say that this is because it is his "castle", his shield against the world. Removing it takes away the artificial barrier between him and the society his sins have negatively affected. Imagine having your house torn down. Discovering a gold plated Maltese falcon in the ruins might assuage one's grief and distress somewhat but it doesn't change the fact that you don't have a roof over your head anymore!
Therefore the two perspectives are connected. A person who is anti-social enough to deserve tzaraas in his house is left with the pretty baubles that he feels makes him wealthy even while a more basic personal need, a domicile, goes missing. One who is content with his home and place in society has no need to find the treasure in the walls. Even without them he has enough. Thus the two perspectives mesh nicely, leaving the anti-social person with the rewards of his efforts.