It's legal if it is disclosed to any prospective buyers before they contract to buy the home. People can agree to buy a home without a water supply, so if the situation was disclosed and you still decide to purchase, that is legal: you will have contractually agreed to purchase sans water.