Facebook has been embedding ads for companies such as BMW and Woolworths in inflammatory articles from websites that target Muslim people and other groups.

The placement allows the publishers of the articles to make money, but is contrary to Facebook's content guidelines for monetisation, which state that an article is not eligible for ads if it is "incendiary, inflammatory, demeaning or disparages people, groups, or causes".

In one example, the ABC found an ad for BMW running alongside an article about how "Obama's Neighbors want him GONE after seeing the disgusting thing he's doing at his D.C. mansion".

The article, shared in a right-wing Facebook group, was from a site called mydeeptruth.com.

A BMW ad displayed in a mydeeptruth.com article about former President Barack Obama. ( ABC News: Facebook screenshot )

In another case, an ad from travel company Agoda turned up in a piece from a site called ClashAmerica, which describes itself as a "mosh pit of breaking news, edgy opinion, lots of attitude, and a call to action for God- and country-loving patriots". The story was titled "Watch: A 'sweet migrant' yelling 'Allahu Akbar' bum rushes Angela Merkel".

Marketing from well-known brands such as Woolworths, STA Travel, the Strand Arcade, Visit Victoria and even the Sydney arts centre Carriageworks has also appeared in such articles.

BMW Australia said it was investigating and "expects the situation to be corrected as soon as possible".

A Woolworths spokesperson said: "We're concerned by this placement as it is clearly at odds with the values of our brand.

"We've paused the campaign and won't recommence it until Facebook can provide assurances this kind of placement won't happen again."

Why is this happening on Instant Articles?

The ad placements are possible via Facebook's publishing tool Instant Articles, which was launched in 2015.

It's a system that allows online publishers to publish their articles directly on Facebook, where they load much faster than on the original website. The publishers can also earn money from advertising placed in the articles.

To become an Instant Articles publisher, outlets must have a sample of their content initially reviewed by Facebook, and are supposed to meet content guidelines for monetisation.

After being contacted by the ABC, Will Easton, managing director of Facebook, Australia and New Zealand, said that "after review" both mydeeptruth.com and ClashAmerica had violated monetisation eligibility standards and had now been removed from running advertising on Instant Articles.

"We take brand safety incredibly seriously at Facebook and work hard to detect and remove ads from Instant Articles that violate our policies," he said.

"We also provide advertisers multiple tools to proactively protect their brands."

Facebook did not disclose how much money the two publishers made.

Ads for brands like Agoda and Visit Melbourne appear in a variety of Instant Articles. ( ABC News: Facebook screenshot )

So how did this happen?

Programmatic ad buying — where software automatically decides placement of ads based on metrics such as target audience, cost and pageview counts — has become a significant challenge for the Silicon Valley giants.

In 2017, one of the world's largest advertisers, Unilever, threatened to pull ads from Facebook and Google over fears its content was appearing alongside extremist content.

Australian companies like Telstra also stopped advertising on YouTube last year as a result of similar concerns.

Chris Johnston, of media agency Slingshot, said clients were hyper-aware of the risk of their ads appearing in the wrong place.

The digital marketing industry uses blacklists, among other methods, to keep ads away from dodgy publishers, but "it's not a perfect science," he said.

Brands can block their ads from appearing on certain publishers or categories of content on Facebook.

Instant Articles are indicated by the lightning symbol. ( ABC News: Screenshot )

The recent Cambridge Analytica revelations, where it was reported about 50 million user records had been improperly obtained by the political consultancy firm, have also raised questions.

In the UK, IBSA, which says it represents more than 3,000 advertisers, said the use of customer data for political advertising was "deeply concerning" and said it had met with Facebook last week.

Mr Johnston said brands, publishers and ad buyers were constantly battling bad actors, but they were also asking questions.

"Every time these things happen, we have clients coming to us saying, 'Well, should we continue with Facebook?'" he said.

"I think what we want to see from Facebook is commitment and diligence around addressing these problems."

A Visit Victoria spokesperson said the ad placement would be reviewed immediately.

The Strand Arcade and Carriageworks declined to comment, while other advertisers mentioned in this article did not respond to requests for comment.

The ABC was unable to reach mydeeptruth.com or ClashAmerica.