Brewer's Dictionary of Phrase and Fable relates a couple of examples of 'Cheating the Devil'.
Cheating the devil. Mincing an oath; doing evil for gain, and giving part of the profits to the Church, etc. It is by no means unusual in monkish traditions. Thus the "Devil's Bridge" is a single arch over a cataract. It is said that his Satanic Majesty had knocked down several bridges, but promised the abbot, Giraldus of Einsiedel, to let this one stand, provided the abbot would consign to him the first living thing that crossed it. When the bridge was finished, the abbot threw across it a loaf of bread, which a hungry dog ran after, and "the rocks re-echoed with peals of laughter to see the Devil thus defeated." (Longfellow: Golden Legend, v.)
The bridge referred to by Longfellow is that over the Fall of the Reuss, in the canton of the Uri, Switzerland.
Rabelais says that a farmer once bargained with the Devil for each to have on alternate years what grew under and over the soil. The canny farmer sowed carrots and turnips when it was his turn to have the under-soil share, and wheat and barley the year following. (Pantagruel, book iv. chap. xlvi.)