Each state sets the rules regarding the state tax impact of 529 contributions and usage.
from the scholarshare529 Plan Details & Information
California State Income Tax Information
In addition to federal tax benefits, there are state tax benefits as
well. For California taxpayers, tax treatment is as follows:
While contributions are not deductible for California income tax
purposes, earnings accrue free of state income tax. Any withdrawals
used for qualified higher education expenses and outgoing rollovers to
other qualified 529 plans and 529A ABLE accounts are also state income
tax free.
Withdrawals for tuition expenses at a public, private or religious
elementary, middle, or high school, registered apprenticeship
programs, and student loans are subject to state income tax and an
additional 2.5% California tax. You should talk to a qualified advisor
about how tax provisions affect your circumstances.
When you pull money out of the 529 to pay for student loans the money will be:
- subject to state income tax
- an additional 2.5% California tax
So even if you transfer the money to a 529 plan for you, at least part of the money will be subject to taxes when used to pay off a student loan.
My experience with 529 plans is that every withdraw is part contribution and part earnings.