States that have a tax break for contributions to a 529 plan will generally require you to pay taxes on non-qualified principle withdrawals. There may be some that don't but I would expect that loophole to be a mistake that they'll eventually catch and close, so I wouldn't rely on it too much.
It is possible that the 10% penalty + retirement tax bracket is less than your current tax bracket, so it is possible to come out ahead. That applies to Traditional IRAs and 401ks as well, although there are generally ways to avoid the penalty in those accounts. However, let's keep in mind that contributions to a 529 plan are not federal tax deductible. State taxes are generally a lot less than federal taxes, so even if you can save a few bucks on state taxes it won't be anywhere near as much as you can save with an account that works for both state and federal taxes.