I've had employers make me sign contracts that strictly forbade moonlighting and anything I developed while employed there belonged to them. I no longer work there, and don't sign agreements like that anymore, but they exist and aren't terribly uncommon.