Several months ago, Casper, the most prominent of a new generation of mattress makers that rose to prominence through e-commerce, held talks to sell itself to Target.

Those talks fizzled as the two sides failed to agree on terms. Instead, Target is now leading a new investment in Casper — as the mattress maker aims for an initial public offering down the road.

Casper plans to announce as soon as Monday that it has raised $170 million. The investment is being led by Target, which on Sunday began selling Casper mattresses, pillows, sheets and more in its stores and on its website.

“The reality that we face is that a vast majority of people don’t know that we exist,” Philip Krim, Casper’s chief executive, said in a telephone interview. Partnering with Target, Mr. Krim said, will help change that.