You can absolutely discriminate based on age and gender for insurance purposes, though. Men are charged higher rates than women. Teenagers are charged higher rates than those in their 20's or 30's. A newly licensed 16 year old male will cost more than a newly licensed 26 year old male. My insurance went down when I got married (which is not outside of my control, but is still a protected class).
If there is valid statistical evidence that a certain group of people (male teenagers with divorced parents, single women in their 40's earning more than $60k a year, divorced white men in Massachusetts, whatever) is likely to behave in riskier behavior for whatever reason, you can bet an insurance company somewhere has the data and is charging accordingly.