My current Fortune 500 tech company's contract explicitly said that if I moonlight, I cannot work for their competitors. And if I get a second job or contract work, I should discuss it with my manager or HR. It does't say anywhere that I cannot have second job at all.
I know 2 SWE in the company who actually discussed this with their managers and got okay in writing for their consulting businesses.
EDIT: Really curious if SWE actually read their contracts or they just assume that they are not allowed. I don't remember my contracts from earlier jobs. It would be interesting if we can have a site like levels.fyi for contracts.