LED current limiting resistor and Ohm's Law
Because not all of the 5V voltage is dropped across the resistor. Some is dropped across the LED ... if they used 3.4V in the example it must have been a blue or white LED ... leaving only 1.6V across the resistor. 

Put a red LED in there (which drops 1.7V) and it would leave 3.3V across the resistor. So what resistor would you need to get 5ma now?