Back in the days when cheques were common there was a great scam in the UK. A company promising to sell porn magazines and VHS tapes at (for the time) cheap but believable prices, but never sending out any product (never actually having any stock). They just worked on the basis that most people would not complain. When people did complain they appologised, gave some excuse about their importers failing to deliver or some such, and a full refund was sent by cheque. To reduce the outgoings, the cheques carried the (obviously porn related) name of the company meaning many people didn't want to pay them in as it would require looking the cashier in the eye if they noticed where the cheque had come from (there were no automated cheque processing machines back then). The scam only came to light when the "company" was investigated for other irregularities (IIRC some of the products they were claiming to sell were illegal, or at least close enough to the legal borderline to warrant investigation, which is what caught the eye of the authorities).
I wouldn't be surprised if the more unscrupulous ones took this to a greater extreme.
If a boy was born, everyone was happy and the doctor kept his fee. If a girl was born, the parents would go back to the doctor where he would explain that the technique wasn't 100% reliable but happily gave a refund with a little extra as a goodwill gesture.
The scam was thet the doctor wasn't doing anything at all. Births remained roughly half boys and half girls. The fees paid by parents of baby boys more than covered the running costs and the goodwill payments.
(I'm not going to check Snopes. Its such a good story I don't really care if its real or not.)