Who says that they do? Amazon is well known for having a rather high level of acquisition of new talent and a relatively high level of turn over. Their HR department literally looks all over the world for new talent constantly. So I would say they don't keep their best engineers from quitting.
At my previous company I remember some devs got fed up with things and jumped ship for Amazon. After about 6 months only one was still there.
Read the bit about Lisp. Explains what Amazon did And how it went wrong.
Noncompetes would be one way. They are based in Washington which unlike California allows noncompete agreements.
they have a pretty bad reputation already. I'm sure they won't be able to hire anybody with non-competes. Remember there are Microsoft/Google/Facebook and many startups in Seattle; ppl have choices.
I'm not so sure they really want the best candidates, as they come at a premium. They may settle for someone desperate for income they can lock in with a non-compete, then use them up and wear them out.