Colleges typically consider a student under a certain age (age 24 in California) to be a dependent of their parents. Therefore it is the state residence of the parents (not the student) which typically matters for in-state tuition.
In regards to “do the schools know that students are doing this” I don’t see how the schools would care. If I moved to a different state from my partner then I’d be paying that states taxes (property tax, sales tax, gas taxes, income taxes) for the majority of days in each year. The parent is either a resident of the school’s state or they are not.
As a California resident (highest taxes in the world) there would be several advantages if either my spouse or I became a resident of a different state (converted a job to fully remote and moved residences to another state). However, our incomes are generated in CA so CA will tax us anyway.
We have a family friend (11th grade) whose parents are divorced and live in separate states. She is solely a dependent of her father and has very little contact with her mother in the other state. So in that case I doubt she would get in state tuition to both states, but I don’t think that is right.