The answer (which I had some difficulty accepting, but now agree with*), is that that is not a relative pronoun at all, but a complementiser. It is the same that as in
He said that he was going
So, on this analysis
The house that you bought
The house which you bought
have different structures, and both relate to a (now obsolete) form
*The house which that you bought
This is found in Early Modern English, but in Modern English at least one of which and that must be omitted.
Since that is not a pronoun (a noun phrase) but something different, it cannot follow a preposition; so in the theoretical underlying
*The house in which that you lived
the that must be omitted, but the which cannot be.
*There was a long thread on this forum a couple of years ago where somebody said this, and I disputed it, but they eventually convinced me. I haven't been able to remember what to search for it by, though.