I think it's not about productivity, it trains programming mindset. Before a fairly easy problem (like count prime numbers in first n integers), 9 out of 10 students might think that they know the answer and start typing. But very likely, their solutions miss some edge-cases, or not the optimized way.
One of the benefit of writing code instead of typing is that it forces students to think before typing. It's easy to insert/delete a code line, but it isn't so easy to write between paper lines. Even if they do write between the lines, the imperfect writing gives hint about their imperfect approaches, which imply some space to improve.
As my comment above:
In my university time, there are 2 classes of fundamental programming.
The class in which the professor requires students to write code to
paper generally performs better to the other class (in a programming contest which uses real computer)
Of course, the above quote is only my observation, but it gives a hint about how it works.