A retract of a finitely generated free monoid is free even though submonoids need not be free. I don't know about the infinitely generated case. 

Edit: infinitely generated seems ok. The fg case I saw in an automata theory book but I see a general proof.