The income gap between white and Black young adults was narrower for millenials than for Generation X, according to a new study that also found the chasm between white people born to wealthy and poor parents widened between the generations.

By age 27, Black Americans born in 1978 to poor parents ended up earning almost $13,000 a year less than white Americans born to poor parents. That gap had narrowed to about $9,500 for those born in 1992, according to the study released last week by researchers at Harvard University and the U.S. Census Bureau.

The shrinking gap between races was due to greater income mobility for poor Black children and drops in mobility for low-income white children, said the study, which showed little change in earnings outcomes for other race and ethnicity groups during this time period.

A key factor was the employment rates of the communities that people lived in as children. Mobility improved for Black individuals where employment rates for Black parents increased. In communities where parental employment rates declined, mobility dropped for white individuals, the study said.

“Outcomes improve … for children who grow up in communities with increasing parental employment rates, with larger effects for children who move to such communities at younger ages,” said researchers, who used census figures and data from income tax returns to track the changes.