The demonstration, UK railcards, is a bit odd. I thought they were sharing too much information, date of birth when only something like "under 18" would be needed. But these railcards have several different age-based options. What is the point of this age discrimination, surely you take up one seat on a train regardless of your age?
I'm not familiar with the specific situation in the UK, but age-based discounts can support many policy goals.
Maybe you want teenagers to be more independent, instead of relying too much on their parents for transportation needs. Maybe you want young adults get used to using public transit instead of driving everywhere, which can lower infrastructure costs in a densely populated country. Maybe you want to encourage retirees to get out and participate in the society, instead of sitting alone at home. Or maybe you want to encourage the use of public transit outside peak hours, which could reduce the overall need for subsidies.
Simple systems, such as age-based categories, often work well enough. Targeted subsidies can be more efficient in principle. But that assumes that regulators manage to target them properly and have the regulations implemented in software correctly and in time. All of those often fail. And even when they are successful, they may cost more than you save with better targeting. Not to mention the opportunity costs: when regulators focus on one thing, they can't work on another.
The Railcard website you linked is pretty clear.
> For those aged 16-25, save 1/3 off rail fares for days out, seeing family and friends and even festivals!
> For those aged 60 and over, save 1/3 off rail fares for days out, holidays, seeing family and friends, and theatre trips!
So, provide proof of age via ID and get a discount. It's very common on public transit for the young and elderly to get a discount.
Age is a proxy for money. You want to set the price for optimum profit (assuming the rail company isn’t controlled by the government and implements social measures), so you want to charge every group of people the amount where (number of costumers)*(profit per customer) is maximized. If you would price every group the same fare, some people wouldn’t get a ticket and you would lose customers. It makes sense to charge those users less, but try to keep the profit of other groups higher by not reducing their fare.
Railcards in the UK have a complicated history, but essentially there's a sliding scale of discount you can get up to the age of 30, in order to encourage more young people to use the rail network. You get more discount under 18, some between 18 and 25 for one price, and some between 25 and 30 for another price.
Additionally, the way the discounts work is that you buy a pass that lasts for a period of time. That then needs to work with your current age. i.e. you can't buy 2 years of discount for under 30s at 29, you can only buy 1 year, so they need to share your age and I think possibly in some cases, date of birth.