Just a stub of an answer, sorry. If nobody else will give you a better answer and I have time, tomorrow I will elaborate a bit more.
I believe that functionality is done by attaching a drupal behavior (from the Drupal standard js library) to the field you are considering. If I am wrong, then it is simply an "ad-hoc" jQuery function.
However that's the easy part! ;) The tricky one, is that the functionality is achieved through AJAX and not by simply generating an extra form field client-side. This is so because the form API must regenerate the form entirely, otherwise - on submission - additional fields that where not originally sent to the browser will be simply ignored (this is intended, in order to prevent injection).
HTH at least a bit! Sorry for being so concise.