> I have no idea how.
It's not hard, or a new problem. For example in the UK paid for political campaigning on radio and TV has been banned pretty much since the dawn of those mediums. In terms of print, you can have media pluracy rules, to stop the concentration of power.
Any kind of election spending, at the local and national level, is regulated and capped.
Now people have been using less visible targetted online ads using dark money to try and get around this - in my view this is an extremely serious offence and people should go to prison.
You could go further and make it illegal to spend money on online ads for any kind of political campaign whether it's aligned to a party or not ( ie single issue ) - with penalities for the companies hosting those ad campaigns as well as the people running them.
You could include astroturf botnets as part of this definition.
Sure these things can be worked around - but the point is the risk of being caught breaking the rules, and the political damage as a result, will make people think twice.
One of the problems at the moment is people are getting away with a slap on the wrist - in my view undermining democracy is a serious offence - and it's about creating a culture where that's the prevailing view.