I have first hand experience with this, as a former high school dropout, now close to completing a math degree just before the age of 40. The cost to the school system to keep me engaged rather than bored and ignored would’ve been minuscule compared to all of the lost tax revenue from me staying out of the workforce for over a decade and a half.
None of that has anything to do with forcing gifted kids into math research. And there are a hell of a lot more gifted kids than just the Olympiad gold medallist prodigies. I could’ve learned calculus in elementary school but I am far, far away from someone like Terence Tao.