You can indeed, and countries do indeed have laws governing this, as does Romania[1]. The sources of spending for electoral ads have to be very transparent, and adhere to various regulations, such as that foreign governments, institutions and companies cannot finance local elections.
[1]: https://legislatie.just.ro/Public/DetaliiDocument/73672