Both kinda. There is nothing in my contract saying that what I create is owned by my employer. Likely because of mergers and because I wasn't hired for a developer role. If you're hired today the contract will absolutely say that they own everything.
And most of the stuff I write has a use outside of work, even if it's just for myself to learn something. So that's why in 90% of cases I start with making something open source and just use it at work.
So it's no different than me using someone elses open source code, it's just written by me, both on and off duty.