If you could gain access to a pay phone's phone connection, you could splice in a simple circuit that would allow coin return signals to go through unmodified but would invert coin collect signals, thereby always returning your coins.
Of course, if you could tap into a pay phone line, you might notice that grounding one side of the line produced a dial tone, enabling you to make free local calls. Long distance was a less trivial problem, since the operator would come on and ask for more money, verified by listening to gong sounds (later beeps) that the phone would send when coins were inserted. An obvious solution was to play a tape loop of a quarter being inserted enough times to represent the required payment. Later, this came to be known as Red Boxing, the Red Box being an electronic circuit that replaced the tape loop, emitting the desired number of beeps to represent whatever sum was due.