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.