They don’t manufacture them, they contract with factories who make those products. So Wal-Mart finds a toilet paper factory and hires them to make toilet paper and wrap it in Great Value packaging… maybe Wal-Mart has developed their own specifications for that product, or maybe they go to a company and say they want a product they can sell for $X and have the product developed and/or produced. They also contract with a nut roasting facility to make and package nuts, and an orange grower co-op to squeeze and bottle orange juice.
There are some companies that specialize in white label goods — that is making products for various companies to sell under their own brand. They can adjust the products’ recipe or specification for each company. Also, brand name products might have extra capacity and might sell production capacity. So a line that runs 2 shifts a day of Ragu pasta sauce might run a shift of Great Value (changing the recipe) as well.