That's a Google AdSense thing. The devs don't get to choose individual ads that get shown, and you know that Google sure as hell isn't checking for malvertisements.
You would have to either take it up with Google or pay for the premium version. I've paid for both the Reddit version in the past and currently the Lemmy version, and it's worth supporting the dev for the work they do.

