At the very moment that the bullet sticks to the rod, the rod remains vertical and therefore the weight of the bullet is downward along the line passing through the hinge. The torque then is zero. You can, therefore, apply the conservation of momentum to the moment just before and just after the collision.
Following the collision, the rod begins to rise due to the impulse transferred to it and as it is no longer vertical, the torque due to its weight will no longer be zero. Therefore you cannot apply the conservation of angular momentum for the motion following the collision. (But you can apply conservation of energy now!)
This setup needs to be thought of in three distinct phases: before the collision, a small time $\Delta t$ around the moment of the collision, and finally the motion after the collision while the ball is rising. Your question is not 100% clear about which phase you're concerned with, so I'll give a brief description of all three.
Before the ball hits the "pointy edge", gravity does indeed exert a torque on the ball if we take the "pointy edge" to be our origin point. So does the normal force from the surface it is rolling on, before it hits the edge. Since these two forces are equal and opposite and act along the same line, they exert opposite torques before the ball hits the pointy edge, and so angular momentum is constant with respect to this point.
In a small amount of time $\Delta t$ around the moment of the collision, the ball may experience an impulsive force from the pointy edge; this exerts no torque. In addition, in this brief amount of time, the torque from gravity will be approximately $m g \ell$, where $\ell$ is the horizontal distance between the edge and the center of the ball. This means that the change in angular momentum of the ball in this time will be approximately $m g \ell \Delta t$, which is negligible if we take the limit $\Delta t \to 0$. Thus, in the collision with the edge, angular momentum is conserved. This means that the angular momentum of the ball immediately after the collision is the same as it was long before the collision. (It is not immediately clear to me whether energy is conserved in the time $\Delta t$ around the collision; I suspect it is not.)
Finally, once the ball has lost contact with the surface below, the normal force vanishes, while gravity still exerts a torque. As before, the contact force exerts no torque on the ball. Thus, there is now a net torque on the ball, and the angular momentum with respect to the pivot point will no longer be constant. This means that we can't use angular momentum conservation to make statements about the motion of the ball while it is "tripping" over the edge. Energy is still conserved from the moment after the collision onwards, though. (This is important for some problems you might ask about this setup.)
Best Answer
There is a torque, but it points sideways, perpendicular to the orientation of the hammer at any time. Because of this, as the hammer rotates, the direction of the torque also rotates around with it. The torque only acts to rotate the system horizontally around in space, not to change the direction of its angular velocity.
Let's see this with a calculation. Suppose I model the hammer as a rod of length $L$ and mass $m_r$ with a point mass $m_p$ on the end.
The moment of inertia of the hammer at this moment can be computed by taking the moment of inertia of a similar configuration aligned along the $x$ axis and rotating it by an angle $-\theta$ in the $y$ direction:
$$\begin{align}I &= R_y^{-1}\begin{pmatrix}0 & 0 & 0 \\ 0 & \frac{mL^2}{3} + m_pL^2 & 0 \\ 0 & 0 & \frac{mL^2}{3} + m_pL^2\end{pmatrix}R_y \\ &= \begin{pmatrix}ML^2\sin^2\theta & 0 & -ML^2\sin\theta\cos\theta \\ 0 & ML^2 & 0 \\ -ML^2\sin\theta\cos\theta & 0 & ML^2\cos^2\theta\end{pmatrix}\end{align}$$
where $R_y$ is the rotation matrix around the $y$ axis and $M = \frac{m_r}{3} + m_p$. Computing the angular momentum using $\vec{L} = I\vec\omega$, where $\vec\omega = \omega\hat{z}$, I get
$$\vec{L} = ML^2\cos\theta(\hat{z}\cos\theta - \hat{x}\sin\theta)$$
The torque, on the other hand, is
$$\vec\tau = \vec{r}\times\vec{F} = (\hat{x}\cos\theta - \hat{z}\sin\theta)\times (-mg\hat{z}) = mg\hat{y}\cos\theta$$
So the torque actually pushes the angular momentum in a direction perpendicular to both its direction and the orientation of the hammer. This means there will be no change in the amount of angular momentum. It also means that the hammer rotates along with everything else, so that the angular momentum and the momenta of inertia preserve their relative orientation and thus there will be no change in its angular velocity.