In Parshas Metzora, the Posuk states that when Bnai Yisrael will arrive in Eretz Yisrael, they will find that Hashem will sometimes place a Tzoraas affliction upon houses )ויקרא י"ד:ל"ד(. As all of Hashem's actions have significance, we must ask what the purpose of this one is. On a simple level, this Posuk teaches about a situation in which Tzoraas appears on a house, and warns Bnai Yisrael that Tzoraas can be found on one's possessions as well as on one's body. Some Meforshim thus hold that this is really a warning to Bnai Yisrael to avoid certain Aveiros, such as Lashon Hora, because if they don't, their houses will be afflicted with Tzoraas.
Rashi, as well as several other commentaries, disagree slightly, holding that Tzoraas on a house is not necessarily a punishment, and they adopt a different approach. They suggest the fact that the Canaanites, upon learning of the impending invasion by the forces of Bnai Yisrael, hid their valuables in the bricks and walls of their houses. According to the Torah, if the Tzoraas persists on the walls even after the cleansing and waiting period have passed, then the house must be demolished )שם פסוק מ"ה(. When they would demolish the house, the hidden valuables would be found, adding to the wealth and prestige of the person whose house it was, Tzoraas here thus would eventually bring about something good.
Another opinion as to why Tzoraas would appear on a house is suggested by the Tzeror HaMor. He says that Hashem does this to someone in order to teach a lesson. Someone who owns a house might say, "I built this house," or "I paid for it." "It's mine, and no one else's." Hashem thus tries to tell this person that it is really His house, because it is Hashem who allowed him to build it. It is only because of Hashem that the person has whatever possessions he has, and Hashem sometimes has to prove it to the person by showing that he can do whatever He wants to the possession. According to this view, Tzoraas serves to remind a person that he owes whatever he has to Hashem alone.