You're more productive on that job, but if you quit this knowledge is valueless. At first glance, there seems to be little point. After they invest in you, you will be more productive in both your current and alternative jobs. They will have to give you a suitable raise to retain you. On second thought, though, this only means that if you want general training from your firm, you will have to pay for it by working for less.
Internships are a standard example.
By definition, such skills won't help you get a better offer elsewhere. So if a firm gives you some firm-specific training, your productivity rises, but market forces don't force them to give you a corresponding raise. You are more likely to get firm-specific training without a dock in your pay. However, the difference between general and firm-specific training may be weaker than it seems. Firms have reputations for giving raises, and often even have formal pay scales.