There is no legal obligation on employers to 401k contributions, so they can put any terms, conditions, etc. that they like, regarding the amount, the source, repayment of amounts advanced by the company, etc. If there was a written contract stating that company 401k contributions may be recouped from a proft sharing bonus plan, that is legal and enforceable.