There are complex strategies for those willing to plan ahead if a state has generous incentives.
For Minnesota I noticed there was a generous state match. I remember suggesting to a single friend that she should open an account now for herself, and get the state match. It could be transferred to a child later. She rejected the idea on the basis she was still looking for a boyfriend, and financing her child’s (should she have one) college education seemed low priority. Statistically, women in her circumstances are very likely to marry, get pregnant, and wish to send their child to college, and the rate of return on such an investment would have been good.
I suspect most state have closed the loophole of taking a benefit for a contribution, and then not having a offset if the funds were taken out later and not used for qualified educational expenses. However, there may be cases where you plan to move out of the state and might benefit from this.
Some state give a benefit regardless of how long the funds stay. If you have a child in college, it may pay to deposit funds into a 529 plan, get the tax benefit, and then take it out to pay tuition within a month or so.
The Federal rules permit transfer within a family (defined to include cousins). This can make it possible to open many 529 plans if enough relatives live within a state and then collect incentives. For instance Md. permits a subtraction from income for amounts put into a plan for a state resident (limited to $2500 per year per relative, with a carry forward). This is generous enough so someone with numerous relatives in the state can easily eliminate all Md. taxes. It appears that reducing the Md. taxable income to a negative number is not beneficial.
The above problem can be avoided by using an out of state plan, and then bringing money into the Md. plan when the tax break would be useful.
One trap; to watch out for is that the Feds do not allow double dipping. The Opportunity credit can bring you up to $2500 per year per student. However, if all tuition is paid from a 529 plans, this cannot be used. This can be a problem if one has a prepaid tuition plan which pays all the tuition, because then you will have no tuition payments to get the credit for.
In Md. the prepaid tuition plans have a value that can be converted to cash for a regular 529 plan. By doing this I benefited (the cash value due to an up stock market was actually higher than the tuition). Then by paying all of the tuition except for $4,000 from the plan, I could get the $2500 credit (in 2017).
On hidden trap with 529 plans is that it makes it hard to refuse a child that wants to go to an expensive school. It is not clear that the much high tuition and expenses for most private college are worth the much higher expenses (compared to a good state school or even a community college). It is hard to say we cannot afford the private university when you obviously have enough money set aside (and could use it for another child, or a grandchild, or medical school etc.). Because of the tax penalties, yoiu may not wish to take money out other than for education, even if it could be useful for retirement or charitable donations.