Union slave states like Missouri legally held them.
There were abolition laws in some of the border states. I’m not sure if Missouri passed one prior to the ratification of The 13th Amendment or not. Many of those laws called for gradual, rather than immediate, emancipation though, so it’s still possible that there were slaves held legally even if an abolition law had been passed.