True, but that need not be of high importance when assigning credit. Especially in projects that involve a lot of implementation, the high level algorithms and techniques are developed by someone who might be far removed from actually writing code, and that aspect is outsourced to someone much more competent at programming. A lot of PhD students / professors do not have the talent or have not developed the thought process to write complex code, simply because their focus has been on other things.
Exactly. One project I worked on a while back involved me taking a big pile of very clever and complicated Matlab code and rewriting it in python in a way that made it easy to use from other projects and able to read a couple of additional input file formats. If you just look at the commits on that project it would look like I was responsible for 90+% of the entire thing, while in truth I was basically just doing transcribing and cleaning and had basically nothing to do with any of the difficult parts.