If they booked him for stealing, they're granting him personhood, and if they continue to claim that he's their property after that wouldn't that mean it's slavery and hence illegal and so they should be dishonourably discharged and booked for slavery? >!(I haven't watched much of Star Trek, just basing it on other conversations I've seen on this topic and overthinking is my pastime)!<
I think your slavery analogy holds. I don't think the Federation believes Data can be a slave because they don't believe he is sentient. But they do pick and choose how to apply their legal code to Data.
Even during the runtime of Next Generation, Data had a very controversial status (in-world). He is technically a free person, and was eventually granted these rights, but was also often treated as a tool or brainless machine by Starfleet.