I didn't say it was illegal. But sorry, I don't advocate lying. I know from past experience, on both sides of the desk, just how easy it is for information to fall into an employer's lap, often when they aren't even looking for it. Good thing for me I hadn't lied about anything in my history when, for example, my new boss turned out to be my father's next door neighbor, or in another case when by a series of mergers and spin-offs my old boss from one job turned out to be my new boss in another one.
On the other side of the line, I've gotten information about past and current employees, without looking for it, from vendors and brokers who worked with me and with them and volunteered it. "Oh, you're the new HR manager at XYZ? I know someone who works there; do you know Claudia Jones in Accounting? She went to work there after the incident at ABC." Ummm, what incident would that be? She didn't mention anything of the kind. And yes, that is a real-life example.
Any given industry is a small world and getting smaller every day. Far too easy for employers to learn information about their employees to take the risk. You might have an income for a short time, but after you get fired for lying, you either have to lie AGAIN, or then explain to a prospective employer just exactly WHY you lied. Digging the hole deeper. Much easier to be honest in the first place.