The law has always lagged behind politics, slow to stop elections being bought and sold. Ever since the days of Old Sarum, the rotten borough that changed hands for huge sums for the value of its two parliamentary seats, the law has tried to reduce the electoral power of money. Hogarth mocked electoral bribery, yet the country is still swayed by an unjust electoral system that encourages the spending of large sums: why would donors give, except to affect the result?

The Commons last night took another momentous Brexit decision on granting ministers draconian Henry VIII powers. Yet this knife-edge parliament, propped up by a £1bn bribe to the DUP, might have been differently configured had electoral law been fairer and the playing field not tilted by cash at the last election. That is the conclusion of Elections for Sale?, a Joseph Rowntree Reform Trust report, written by Chris Bowers, which is published on Wednesday.

The law still limps behind modern electioneering. While TV airtime can’t be bought, there is no bar on social media advertising, no scrutiny of undercover data used to target particular voters, nor can that invisible spending be easily counted. The legal border between a party’s national spending and its targeting of particular constituencies has become so fluid that the Crown Prosecution Service was unable to prosecute flagrant breaches of the spirit of the rules in 2015. Police investigated cheating by 30 individuals, but only behaviour by three people in one seat met the high bar for prosecution. The report calls for a lower threshold to make it easier to force the re-run of corrupted elections.

The otherwise dismal referendum campaign was a lesson in fairness – when every vote mattered, more people voted

Parties can spend up to £19.5m on a general election: in 2015 the Tories spent £15.6m and Labour £12.1m. But in each seat the limit is £14,000-£15,000, according to population. Our warped electoral system gives every incentive for parties to disguise spending on marginal seats as central costs. This study, focused mainly on the 2015 election, shows how far parties directed national funds to a few marginals, against the intent of the law.

Take the example of personally addressed letters in marginals, signed by David Cameron: they went to every voter in St Ives, mentioning “here in St Ives” five times – yet the Electoral Commission allowed the cost to be charged to the party nationally, because the local candidate’s name was not used. The Tories took that seat off the long-standing Liberal Democrat MP. Similarly, as Channel 4 News exposed, the cost of Tory battle buses full of activists touring marginal seats was often charged to the party centrally.

Paid-for telephone canvassing is illegal, though volunteers can man phone banks. But this report points to “push-polling” – covert advertising where paid-for companies purport to conduct polls, but their slanted questions are blatant campaigning.

Social media didn’t exist when the last electoral laws were passed in 2000: Facebook arrived in 2004 and by 2015 was used for 99% of political internet advertising. Message-sharing between private Facebook users is not the problem, but no law stops a party buying expensive advertising finely targeted at key voters. Facebook has so much personal information it can select messages for swing voters specified for age, class, interests and marginal seat location. No one else can see or test the truth of those messages. The Tories declared £1.2m in Facebook advertising nationally, and this report suggests most targeted particular seats.

While printed leaflets must reveal a publisher, in the wild internet no one knows who paid for a message, or who is accountable for any untruths. Facebook, says the report, should be forced to make this spending and data collection transparent. These allegations have mainly been against the Tories, but Labour is not immune.

The great British Brexit robbery: how our democracy was hijacked Read more

Does money succeed in buying elections? This research suggests that it matters more than ever, with fewer doorstep volunteers. In both 2015 and 2017 it’s hard to imagine that the millions spent on relatively few voters didn’t swing the result. Many seats were won by low margins: Gower in south Wales relied on a swing of just 0.04%. In 2017, 10 constituencies were won by under 100 votes and 52 seats were won by under 1,000. Big money almost certainly “bought” key seats – critical to the result in 2017. The report calls for state funding of parties: rewarding mega-donors with “honours” has for years poisoned voter trust in politics.

Both the forensic detail and the broad thrust of this report make an undeniable case for urgent reform. It raises the great underlying electoral issue: the incentive to cheat will be propelled by the first-past-the-post system for as long as a handful of marginal voters, often as few as 200,000, decide the whole country’s fate. A proportional system would see every vote weighed equally, each as valuable as the next, no “safe” seats, no marginals. The only good lesson of the otherwise dismally fought referendum campaign was a reminder of the fairness in valuing each vote everywhere the same. When every vote mattered, more people came out to vote.

Money helps lock us into this system. Tories cling to it because they raise most to buy marginal votes most effectively. On Brexit, parliament is making the most far-reaching decisions of our lifetimes, yet hanging by a thread we have a government elected in part by rule-bending, bribery and vote-buying.

• Polly Toynbee is a Guardian columnist

• This article was amended on 12 September 2017. An earlier version said police investigated cheating in 30 constituencies, but only behaviour in three seats met the high bar for prosecution. This has been corrected to say police investigated cheating by 30 individuals, and behaviour by three people in one seat met the high bar for prosecution.