Advance Auto Parts is acquiring Sears' DieHard brand, known for its car batteries, for $200 million in cash, CNBC has learned.

Under a supply agreement, Sears and Kmart owner Transformco will still have the rights to sell some DieHard items in Sears stores, Advance Chief Executive Officer Tom Greco told CNBC in a phone interview. Advance Auto Parts will also give Transformco an "exclusive royalty-free, perpetual license" to develop and market DieHard products in other nonautomotive categories.

The deal also provides Sears and Kmart with much-needed cash. The retailers have been trying to turnaround their businesses since filing for bankruptcy in 2018, but they appear to be facing some of the same struggles they had seen before the Chapter 11 filing. In November, Sears had secured an additional $250 million lifeline from lenders that included Eddie Lampert.

Greco said Advance started to have conversations with Transformco in the middle of this year.

"We have been looking at the [battery] category for a couple of years," Greco said in a phone interview. "DieHard has the highest brand awareness and regard of any automotive battery brand in North America."

Even before its bankruptcy, Sears had been trying to sell assets to infuse cash back into its business. It sold its Craftsman tool brand in 2017 to Stanley Black & Decker.

"[W]e have long believed that the [DieHard] brand has even more potential," Peter Boutros, president of Transformco's Kenmore, Craftsman and DieHard business unit, said in a statement. "Advance Auto Parts' acquisition ... will complement our plans to introduce new DieHard products in non-automotive categories such as sporting goods, lawn and garden, authentic work wear and other exciting new categories."

Lampert, a hedge fund billionaire and former Sears CEO, paid $5.2 billion and promised to save 425 Sears and Kmart stores and roughly 45,000 jobs when he struck a deal to buy the company out of bankruptcy in February.

But the embattled department store chain's real estate footprint continues to dwindle. In November, the company said it would be closing 96 more Sears and Kmart stores. By early 2020, the entire business will be left with 182 locations.

At the time of Sears' bankruptcy, there were more than 700 Sears and Kmart stores.

Transformco had recently said it was still exploring ways "to realize a significant return on our extensive portfolio of owned and leased real estate," which includes logistics business Innovel, Sears Home Services, the Shop Your Way membership program and Kenmore.

For Advance, the deal will help the auto parts retailer grow its portfolio of brands and drive more traffic to its thousands of stores. It hopes to attract people who are loyal to the DieHard brand, which has been around since 1967.

In December 2017, prior to going bankrupt, Sears struck a deal to sell various items from the DieHard brand on Amazon. Greco said that partnership will not be continuing with Advance. But instead, the Advance CEO said his company will be looking to bring DieHard to some of its other retail partners, including Walmart.

Sears also still operates three DieHard stores, but has no plans to open anymore. Advance will be able to decide if they want to keep them open or close them.