Under no circumstances is any legacy applicant gaining admission without being well-qualified, so colleges should have autonomy in their admissions decisions with the government staying out of the way. There are plenty of approaches to admissions that ensure a diverse student body without punishing those who want to exercise their loyalty and commitment to a school that matters to their family.
Legacy admissions are typically well-qualified, but giving them preferential treatment shatters the idea of a meritocracy as much as giving an admissions advantage to applicants based on race or gender. Laws like this may not have the impact on the makeup of student bodies that legislators hope, but in the name of fairness and the credibility of colleges, legacy admissions should end.