It’s not unusual for platforms to allow targeted ads—companies want to reach interested consumers, and users may prefer ads that are relevant to them.

But a suit brought against Facebook Inc. by the U.S. Department of Housing and Urban Development on March 28 shows platforms allowing targeted ads may face increased legal risks if in-house counsel aren’t monitoring advertiser posts or implementing guidelines, lawyers said.