ageism, as opposed to sexism or racism has a built in karma.
if you are white, you'll never be black. if you're a man, you'll never be a woman
but if you are 20, some day you WILL be 50. therefore, all of the hatred you dish out will be visited back on you... by your own self. karma still applies to sexism and racism, but it comes back in the form of other people's views of you. not the special hell of a self-created low self-opinion
if you are 20, and have a bad attitude towards the aged, someday, you will have a bad attitude towards yourself. self-hatred is something all of us carry around to some extent, but to have self-hatred gradually grow as you get older must be a terrible weight to bear, and it keeps growing
you can see it on the street: the guys with the ridiculous fake hair and the women with the ridiculous facial plastic surgery: this is self-hatred. who wants to walk around broadcasting their lack of confidence and stinking of desperation, to telegraph that you want to be something you can never be again? to worship youth, but then turn into someone old, must be a terrible experience to go through. to simply look at yourself in the mirror and be filled with anguish: built in karma for being an ageist. this also might explain some suicides by people in their 40s and 50s
meanwhile, if you always treated the elderly fairly and gracefully, then when you yourself are older you will still be confident, and still like yourself, because you will treat your older self the way you treat older others today. built in karma still applies, but in the positive: you age gracefully, and have a full happy life
so the cost of being an ageist is to have an unhappy older life
don't be an ageist. look at the elderly and see yourself as you will be someday, and smile, for the sake of your own future happiness. you want to age gracefully, you really do. so prepare yourself psychologically now for aging gracefully, by treating the aged you encounter today with the same grace you want to treat yourself with later