There are several legal principles at play within any college admission system. Harvard receives federal funding, meaning it must comply with the Civil Rights Act of 1964 (which bans any discrimination on the basis of race).
Furthermore, the 1978 Supreme Court case Regents of the University of California v. Bakke banned the explicit use of racial quotas in the college admissions process.
However, later cases clarified that a “whole person review” is legal: colleges are allowed to consider various aspects of a person’s background beyond just race, but they cannot simply admit a student because of their race.
Finally, in 2016, the Supreme Court ruled in Fisher v. University of Texas that colleges could only make use of race-conscious admissions protocols if they could prove such protocols were the only way to meet diversity goals.