1580s, "one allowed to live in a house rented by another" (usually for a consideration), from in (adj.) "inside" + mate (n.) "companion." OED suggests the first element is perhaps originally inn. Sense of "one confined to an institution" is first attested 1834.
updated on November 30, 2015