Access uncapped 5 V output on 3D printer controller board
Any pin that is labeled as "5&nbsp;V" can supply the full amount of current. Looking at, for example, the Arduino MEGA pinout, we can see several pins labeled in red with "5&nbsp;V". These are the pins you can use. Most 3D printer boards will expose the 5&nbsp;V pins at several points. For example, the endstop connectors often have a 5&nbsp;V pin that can be used.

The pins that are limited to 40&nbsp;mA that you are thinking of are the digital pins, i.e. the pins that can be switched on/off by the microcontroller. These are actually more limited than this, and while in some cases drawing 40&nbsp;mA from them may be possible, it is not a good idea.