State tax filing

So if it's seen as any other investment account, then I'm allowed to take some cash out of the HSA to pay the state tax on the realized gain?  This seems counter to the Federal rules for HSA's....