A mechanical code lock is often cheaper than an electronic version, does not require any external power source to function, and has no ongoing running costs after installation. On the other hand, it may have certain limitations in terms of added functionality, features and durability.
A mechanical keypad lock typically only allows each button to be pressed once as part of a code sequence, so you cannot have repeating digits in an access code. You will often find that they are less flexible in terms of time-dependent options and will need to be set in an always locked or always unlocked state manually.
However, the fact that they do not rely on a power source to operate means that they will not underperform or fail due to interruptions in the electricity supply, or suffer problems relating to battery life. They are generally suitable for all install locations and environments (particularly where they might be exposed to moisture and debris), and usually require relatively little maintenance or additional protection from the elements.
Because they tend to have more internal moving parts than an equivalent digital code lock, they may be more prone to the effects of long-term wear in very heavy use.