If one is over 65 years old and the AGI is below $186k, why does TurboTax decrease taxes owed if you make a $7k Roth contribution?

Last year, we made a $7k Roth contribution prior to tax due and because of AGI, it was not allowed so we moved the $7k out of the Roth and received a form 1099R saying it was not taxable. Then this year the above happened.  When we put in the $7000 Roth IRA contribution our taxes decreased.  I thought a Roth IRA deduction would not affect the taxes as it is after tax funds.