MAX485 Receive Output pin current sufficient for optocoupler LED?
The datasheet does not tell you the maximum current is 4mA, it tells you that AT 4mA the maximum voltage drop is 400mV (low) over the full temperature range. 

The voltage drop is only guaranteed to be less than 1.5V (or maybe 1.25V depending on whether they include Vcc tolerance) when driving high, but the design is not using it in that mode. 

Chances are good it will be okay at at 6-8mA since the Vds drop is most likely well under the threshold voltage of the MOSFETs where the I-V curve flattens, but it's not explicitly guaranteed. 

You can see the typical (ie. not guaranteed) receiver output voltage at 8mA here: 



So it's about 0.42V at 8mA/125°C. That means it would be about 0.21 typically at 4mA and they've allowed a bit less than 2:1 margin for variations. If we assume a 0.8V drop at 125°C then your current would be about 6.4mA nominally. The opto is only good to 100°C so we have even more margin. 

Generally you should check the opto data carefully to make sure you allow enough forward current for all temperature and unit-to-unit variations and also to allow for aging of the LED (which is accelerated at high temperature).