A Qing-dynasty origin story: opium smugglers hid their goods in hollow bamboo poles on boats, and river officials would 'tap the bamboo' to demand a bribe — otherwise they'd 'inspect' and uncover the contraband. Tapping became slang for extorting under a pretext. 《
官场现形记》
第17
回 already uses it casually.