E-cigarette maker Juul Labs bought online advertisements on teen-focused websites for Nickelodeon, Cartoon Network, and Seventeen magazine after it launched its product in 2015, according to a lawsuit filed on Wednesday by the Massachusetts attorney general's office.

"Their whole effort was to try to get kids hooked, to get kids to start vaping because they wanted to create a whole new class of consumers," Massachusetts Attorney General Maura Healey told CNBC's "Squawk Box" on Thursday.

The allegations in the lawsuit, stemming from a more than year-long investigation, contradict repeated claims by Juul executives that the company never intentionally targeted teenagers, even as its products became enormously popular among high-school and middle-school students in recent years.

The lawsuit filed by Massachusetts Attorney General Maura Healey said the company worked through online ad buyers to purchase space on websites that were "highly attractive to children, adolescents in middle school and high school, and underage college students," including educational websites such as coolmath-games.com and socialstudiesforkids.com.

"We know that they placed ads not only on websites like Nickelodeon, but also on homework apps," Healey told CNBC.

The attorney general's office said those ad purchases began in June 2015, when the product launched, and continued into 2016. Juul had the ability to put certain websites onto a "blacklist" that would prohibit ads from appearing there, according to the attorney general's office, but the company chose not to do that.