In or near a bunker or sand trap, a ball rolling back toward the player may be hit again on the roll without counting an extra stroke, or strokes. In any case, no more than two strokes are to be counted in playing from a bunker, since it is reasonable to assume that if the player had time to concentrate on his shot instead of hurrying it so as not to delay the game of his playing partners, he would be out in two. If a putt passes over the hole without dropping, it is deemed to have dropped. The law of gravity holds that any object attempting to maintain a position in the atmosphere without something to support it must drop. The law of gravity supersedes the law of golf.
Same thing goes for a ball that stops at the brink of the hole and hangs there defying gravity.
You cannot defy the law. Same thing goes for a ball that rims the cup. A ball should not go sideways. This violates the law of physics. This rule does not apply if the ball is more than three inches from the hole, because no one wants to make a travesty of the game.