Why does water repel foam from a soap?
Soap molecules are opposing. While one end tends to stick to water, the opposite end repels it. Suds are caused by this action. Soap molecules surround water molecules, and the parts of the molecules that repel the water point in a direction away from the water.
Hard water contains the salts of calcium and magnesium, which neutralize the soap. So that more or less amount of soap is precipitated before you get the effect of soap on the water. Only after you have wasted the certain amount of soap, you get the foam in the water. The ability of soap to clean the clothes comes only after foam formation.
You can use regular liquid soap & water to make foaming soap. You want the mixture to be about 20-30% soap, and 70-80% water. (I've read different suggestions on how much soap you should use.) I've also read you should probably not use moisturizing soap - it can clog the pump. You'll need one of those foaming soap pumps in order to make the soap foam, but you could certainly use an old one after…