Yes and no. Gimbal lock is a physical AND mathematical phenomenon. Physically, gimbals sharing the same axis can cause a lock, and mathematically, a representation of a multi-axis rotation can be in a condition which is singular, depending on how it is represented and calculated internally.
Normally, we discuss and think about aircraft attitude intuitively as set of angles: roll, pitch and heading. In mathematical circles, this is known as a set or 3-2-1 Euler angles. If you look into the boring (or exciting, if you are that kind of person) math, you can see a vector-matrix equation relating the change in Euler angles given a set of angular rates given in the frame of the aircraft, by common convention these are referred to as p, q and r for roll rate, pitch rate, and yaw rate respectively. The way these rates affect the change in the angles depends on the current state of the the angles, e.g. when the aircraft is pitched, a body-frame yaw rate will alter the pitch angle. Mathematically, this means that the "state matrix" is state-dependent and must be constantly updated using the freshest set of states available. Any set of Euler angles will have a set of states which causes the state matrix to become poorly conditioned, resulting in numerical instability at those conditions. For the roll-pitch-heading set of angles, this happens when pitch is + or - 90 degrees.
The way that we escape the singularities when writing the software for an AHRS is by representing the attitude in a non-singular form. This done by using more numbers to create the representation, then adding constraints which preserve uniqueness. A 3x3 direction cosine matrix (DCM) can do this, It has constraints which cause it's eigenvalues to lie on a unit circle in the complex plane. My favourite representation, however, is a quaternion constrained to have unit length. The quaternion can be thought of in terms of Euler's rotation theorem. There's that Euler guy again, he must have been some kind of genius. Anyhow, the idea is that you can define an axis of rotation with three numbers, and use a fourth to represent an angle about that axis to rotate. This gives you a system free of "mathematical gimbal lock" The state matrix remains adequately conditioned under all states. All you need to do to keep things friendly is to normalize the quaternion from time to time, and you always have a "background" state that you can translate into aviator-friendly Euler angles.