There are different public employee rules on this in the US, usually focused on actual or perceived conflicts of interest. Different departments of the US government, different states, and different local governments all have different rules.
I once had a case where I was actually hired by our city to bring a court action to invalidate a contract awarded to the mayor's son. When I presented evidence that the mayor had loaned money to his son to start his business, the judge ruled the contract invalid.
When I worked at the state Attorney General's office, they had a rule that we could not practice law outside that office (i.e., privately on our own). This rule was based not only on avoiding conflicts of interest, but on the principle that professional employees aren't limited to a 40-hour workweek, and should be giving all their professional efforts to the state.
If I'd wanted to start a business selling gasoline or hamburgers, though, I suppose I could have done so, provide that it didn't interfere with my workload for the state..