This would be the relevant BCAPL rule...
1-40-d. Placing hand in pocket: It is a deliberate foul if you catch any ball that is falling into a pocket, or place your hand into a pocket while any ball in
play is in motion near that pocket. (AR p. 91)
First violation of (d): if the cue ball, ball in hand. If an object ball, your opponent may have the ball placed along the lip of the pocket, pocketed, or left in position. However, it is loss of game if the ball involved is the game winning ball. (8-Ball exception for first violation: if the 8-ball is involved and it is the break shot, it is not loss of game).
And here's the pertinent stuff from page 91 of the Applied Rulings...
3. Situation: Playing on a table with a ball return system. Player A, either as the shooter or the non-shooting player, attempts to retrieve any ball by reaching into a pocket after the ball has been pocketed but before it has entered the ball return system.
Ruling: Deliberate foul under 1-40-d. Exception: legal if the pocketed ball is stationary but has remained in the pocket because of a defect in the pocket lining or ball return system.