Discrimination is not illegal per se. We discriminate all the time. I like alternative music but usually not country music.
The reason that some discrimination is illegal is a complicated question, and this is only a cursory description. First, generally speaking, the U.S. constitution says that the congress can only make laws that prohibit action by the federal government or the states. The exception is that congress can also make laws to govern interstate commerce. So, congress can only prohibit actions by private parties if those actions affect interstate commerce. The kinds of things that affect interstate commerce are things related to travel, employment, and other more obvious commercial ventures.
The constitution itself only applies to actions by the federal government and state governments. The principle that prohibits discrimination is “equal protection” which is embodied in the 5th (for federal) amendment and the 14th (states) amendment. The 1st amendment also prohibits discrimination on the basis of religion.
Because equal protection isn’t specifically defined, the Supreme Court over the years has tried to define what kinds of discrimination are barred by the constitution. They have started from one premise and added to it. That premise is that the government should be prohibited from making distinctions in laws that are completely irrational. Thus, the cases are about what differences in people or things affected are real differences and what are not.
At first, race was viewed as a real difference justifying different (bad) treatment. That was the “separate but equal” stuff. Then, thanks to some very talented lawyers and a lot of grass roots activism, the Court came to the realization that the nearly all differences between races were not “real” and were just an excuse for treating non-whites badly. So, the Court said they were going to look at every law that made a distinction on the basis of race and presume that the law was invalid unless the government could show that the law served a compelling interest and that it was as narrowly tailored as possible.
Over time, the Court has been asked to look at other groups and to decide how to scrutinize classifications based on membership in those groups. The level of scrutiny is directly related to whether we culturally view the differences of that group from the majority as “real.” So, racial classifications get strict scrutiny as do classifications based on religion. There are some “real” differences between men and women, so gender classifications get only “intermediate” scrutiny. The same is true for classifications based on immigration status. Everything else just has to be marginally rational.
To decide which groups get what kind of scrutiny, the Court looked at the groups and decided that there were some factors. Those groups must be discrete (able to be defined as different from the majority and limited in number) and insular (without a lot of movement in or out of the group generally because one is born with the characteristic) minorities (smaller than the group of nonmembers or lacking in political power if not numerically smaller).
This is also the basis of congress’ attempts to limit discrimination in the private sector. It started with race, sex, and religion, and has enacted other anti-discrimination laws as the majority have agreed that some distinctions aren’t rational and have a negative economic and political impact on a group. That’s where the age and disability discrimination laws come in.
States can outlaw whatever kind of discrimination they want as long as that does not violate their state constitution or the federal constitution. That’s why a lot of states have been trying to pass laws either to protect gays and lesbians from discrimination or to keep such protection from ever being enacted in the future. (The former are usually constitutional while the latter is usually not).
So, in the example here, the distinction between recent college grads and non-recent ones most likely isn’t illegal discrimination. There are rational distinctions that can be drawn between people based on whether they went to college and how recently they graduated. Are there exceptions? Sure. Do they matter? Not under the way these things have to be analyzed.
Finally, this is a sales tactic. Whose to say that the prices finally paid by everyone aren’t the same? The dealer probably jacks up the price of the cars bought by those eligible for the rebates to cover the cost of those rebates.