Lilypad Mini ProtoSnap
Leds exhibit a forward voltage drop at a given forward current. Lower the current or voltage and the other goes down as well.  3.4V @ 20mA leds work just as well at say 2.6V at 10mA, with only brightness being different. Sometimes it's not even a noticeable difference. 

Ergo, the leds are just being driven at a lower voltage/ current. The led datasheet would have a chart for Vf at If.

As to the gpio, it's similar. As the current increases, the voltage drops. Their internal equivalent series resistance causes a voltage droop. In the microcontroller datasheet you would see a graph similar to the one for the led, showing how much the voltage changes for the gpio based on the current. The 40 mA limit is based on a big voltage difference and trying to draw more than 40 mA can blow the pin.

To power the led from gpio, simply limit the current to something the led can use, using the same formula you would use for a normal led on a normal power supply. (Vs - Vf) / If = R. In this case, they decided 150 ohms was a good choice.

if you measure the current through the led, or the voltage across the resistor, you can find out what the current the led is being driven at, to be much less than 20 mA.

To put you at ease, this is very very normal. You don't need to run an led at full brightness for it to be bright or useful. It will last longer like that too.