Experience with buying years in similar pension systems, not teacher ones. Totally supporting all comments that it depends on the exact terms, which vary from system to system.
One subtlety is if you will ever work for a pay rate much higher or lower than your regular salary, some systems allow you to buy years at the new rate. It may be too late for this, but if you work for a low pay rate at first and have savings to buy years, buy them right away when eligible, then switch to a better paying job. Usually the price of the years depends on the pay rate, so the "hack" would be that you bought at a low price, but later had your pension amount based on the higher salary. You could look into the details and see if changing jobs within the district at some point temporarily allows something similar to happen - work as a low-paid aide one year, buy time cheaply, return to teaching.
The effect is somewhat less if you're young and plan to FIRE, though. Because in most systems the pension's monthly annuity payout is based on your highest 3 or 5 years of service, and if you FIRE, inflation has diluted that base by the time you start collecting. Again it depends on the details of your system, though.