As an Open Source developer, I essentially always have at least a half dozen parallel programming projects going on at once which effectively act as a part-time job. As long as there is no obvious conflict of interest, and none of the jobs are hurting because of lack of time or too much stress, a person should be able to do anything they want with their time.
In my experience, the best programmers are the ones with the most exposure to the most projects. This cross-training allows new ideas to flow between projects, and new techniques to be tried out on possibly less critical projects. The most stagnant environment is the office where all the programmers have worked for the same company and on the same project. That run the danger of programmers not having ten years experience, but one year's experience repeated ten times.
As to the question of "loyalty", since a programmer can do many dastardly and undetectable things, employers must already trust their programmers. If they don't trust them enough to allow them to hold a part-time job, they don't trust them enough with their business logic and should either get rid of that programmer or reevaluate their own ideas of trust.
If it's a question of money, the employer/employee relationship is essentially a monetary one. If the employee needs more money either the employer has to pony up, let the employee seek it elsewhere on their own time, or lose that employee to a better paying job. To think anything else is delusion. Preventing your programmers from pursuing side projects is throwing away free training and eventually they'll get frustrated and leave anyway.