Rule 18 - Ball at Rest Moved
If the ball is moved, it must be replaced, unless the movement of the ball occurs after the player has begun the stroke or the backward movement of the club for the stroke and the stroke is made.
Under the Rules there is no penalty if a player accidentally causes his ball to move in the following circumstances:
In placing or replacing a ball under a Rule - Rule 20-3a
20-3. Placing and Replacing
a. By Whom and Where
A ball to be replaced under the Rules must be replaced by any one of the following: (i) the person who lifted or moved the ball, (ii) the player, or (iii) the player's partner. The ball must be placed on the spot from which it was lifted or moved. If the ball is placed or replaced by any other person and the error is not corrected as provided in Rule 20-6, the player incurs a penalty of one stroke. In any such case, the player is responsible for any other breach of the Rules that occurs as a result of the placing or replacing of the ball.
If a ball or ball-marker is accidentally moved in the process of placing or replacing the ball, the ball or ball-marker must be replaced. There is no penalty, provided the movement of the ball or ball-marker is directly attributable to the specific act of placing or replacing the ball or removing the ball-marker. Otherwise, the player incurs a penalty of one stroke under Rule 18-2 or 20-1.
If a ball to be replaced is placed other than on the spot from which it was lifted or moved and the error is not corrected as provided in Rule 20-6, the player incurs the general penalty, loss of hole in match play or two strokes in stroke play, for a breach of the applicable Rule.