Modern vending machines are not so easily fooled.
But, the old UK 5 pence and German 1 mark coins had quite similar dimensions, and were made from the same material, so vending machines at that time were fooled by the 5p, which was worth much less than the mark. I understand that truckloads of coins were sent back to Britain as a result.