I worked exclusively on open-source code (Kubernetes) at Google. I got paid the same amount as my colleagues working on different proprietary projects. In this post, I'll use some economic theory to explain why this was a great deal and why every engineer should do it if they have the opportunity.
The branch of economics that's important for this problem is personnel economics, which deals with labor economics. One of my late professors at Stanford, Edward Lazear, pioneered the field, and I was lucky enough to take his course on the topic.
There are two types of training that you can get on the job: generalized or firm-specific. Generalized training improves the worker's productivity regardless of what firm the worker is employed - schooling is one example.
Firm-specific training improves the worker's productivity at their own firm but does little to change the productivity at other firms. For engineers, this is learning how to use internal tooling or following internal workflows. For example, knowing how to commit changes at Google will not help you at Microsoft.