The first example you provided uses the subjunctive mood. The subjunctive mood is a construction that expresses a condition that is doubtful or contrary to fact. In this case, the verb "to be" takes the past tense form "were" to indicate that his being rich is not true. Using "was" in the first sentence would make it ungrammatical. In the second sentence his being rich is uncertain but not definitely false. From the way he talks, he might, in fact, be rich.