In the United States IP rights go to the inventor and most must be explicitly transferred to an employer. The whole point of the patent office is to encourage inventors to invent and not allow corporations to own everything and prevent competition. Although some companies have attempted to rig the system to prevent competition, ultimately the law has come down to foster competition (see the recent defeats of patent trolls)
And as the other commenter here points out, there are so many cases where someone working at a company discovers a way to improve business in the industry they are employed in, that could compete with their current employer, and that employer is unable or unwilling to devote resources or compensate for it. Huge swaths of US innovation or driven by such things. Probably the most iconic example is Steve Wozniak inventing the Apple I while he was working at HP, which HP refused to acquire and support causing Steve to resign and start Apple.
I also write this as someone with a name on a patent I chose to transfer to a company I helped found for an invention I helped create while working there. But to be clear, that was my choice. Ultimately the law said it was my invention by default, and there was no legal, moral, ethical, or god given obligation preventing me from walking away with it.