Wikipedia contains [blended with previous version]:
Relative pronoun as the object of a preposition
A relative pronoun often appears as the object of a preposition. For
formal writing or speech any relative pronoun serving as an object
must be one that 'takes' the objective case, for example, whom,
whose, or which, but usually not who and never that—both who
and that usually take the subjective case:
Jack is the boy with whom Jenny fell in love (formal)
Jack built the house in which I was raised (formal)
but not
Jack is the boy with who Jenny fell in love (colloquial; or not okay)
and never
Jack built the house in that I was raised (not okay).
In modern, especially informal, English it is not unusual to move the
preposition to the end of the relative clause (as though for an
independent clause) while leaving the relative pronoun at the
beginning of the clause, or omitting it. Such preposition-stranding
(or 'dangling' the preposition) has traditionally been deemed
unacceptable by grammarians for formal style. Still, the ‘stranded
preposition’ form has been widely used since Old English times, and is
normal in colloquial speech. Here is the formal style:
Jack is the boy with whom Jenny fell in love (formal);
but any of the following might be heard in ordinary (including
colloquial) speech:
Jack is the boy whom Jenny fell in love with (not formal);
Jack is the boy Jenny fell in love with (not formal);
Jack is the boy who Jenny fell in love with (colloquial);
Jack is the boy that Jenny fell in love with (colloquial).