Sure you can, it's effectively the same contract agreement as a sign-on bonus that requires you to stay for at least 6 months. Instead it's training cost that you get saddled with if you leave before X time. Of course, the exact monetary value would have to be spelled out ahead of time.
Well, I say sure you can, but I'm not a contract lawyer. It just sounds identical to me. You're not forced to stay, but if you end the contract you have to pay.