The court ruled that both programs violate the Equal Protection Clause of the Constitution and are therefore unlawful. The vote was 6-3 in the UNC case and 6-2 in the Harvard case, in which liberal Justice Ketanji Brown Jackson was recused.
Below is a chart used by Harvard for their undergraduate admissions.
Why colleges should consider both race and class in admissions
"In the United States, economic inequality isn’t race-neutral; it works in conjunction with race. According to the Urban Institute, in 2016, the average white family’s wealth was seven times greater than the average black family’s and five times greater than that of the average Latino family’s. The racial wealth gap is real and persistent. An admissions system that considers only class without addressing race will fall short of fostering diversity, both racial and socioeconomic.
Don’t believe the myth that all of the black kids at Harvard are rich. According to William Bowen and Derek Bok’s now-classic defense of affirmative action at elite colleges, The Shape of the River, black students were seven times more likely to come from poor families than white students. Also, as you might guess, a much higher percentage of white students than black students fell into the top socioeconomic category (44 percent for whites, 15 percent for blacks)." - Julia Park (Education Week)