Disparities in outcomes across social groups pervade human societies and are of central interest to the social sciences. How people treat others is known to depend on a multitude of factors (e.g., others' gender, ethnicity, appearance) even when these should be irrelevant. However, despite substantial progress, much remains unknown regarding (i) the set of mechanisms shaping people's behavior toward members of different social groups and (ii) the extent to which these mechanisms can explain the structure of existing societal disparities. Here, we show in a set of experiments the important interplay between social perception and social valuation processes in explaining how people treat members of different social groups. Building on the idea that stereotypes can be organized onto basic, underlying dimensions, we first found using laboratory economic games that quantitative variation in stereotypes about different groups' warmth and competence translated meaningfully into resource allocation behavior toward those groups. Computational modeling further revealed that these effects operated via the interaction of social perception and social valuation processes, with warmth and competence exerting diverging effects on participants' preferences for equitable distributions of resources. This framework successfully predicted behavior toward members of a diverse set of social groups across samples and successfully generalized to predict societal disparities documented in labor and education settings with substantial precision and accuracy. Together, these results highlight a common set of mechanisms linking social group information to social treatment and show how preexisting, societally shared assumptions about different social groups can produce and reinforce societal disparities.