Laws like this one that restrict businesses from asking questions that individuals could ask strikes me as very strange.
I could ask my buddy how much he made at his last job.
I couldn't ask my buddy how much he made at his last job if I'm considering hiring him to work at my company.
Why is this information legal to acquire when I'm wearing my business hat vs when I'm wearing my friend hat?