A theory I once heard, is that (some) cats like to sit on someone's lap (nice and warm) but don't like to be stroked or anything, since it interferes with sleeping. So they will pick someone who doesn't like cats or is allergic to them, who will tolerate them sitting on their lap but not do anything about it.

How the cat is supposed to know beforehand that somebody is allergic to them, I don't know. Body language?