Dialysis serves the same purpose as the kidneys: the body's blood comes out of the body and passes through the machine and returns to the body, now cleaned.
Blood is drawn out from the body of the patient, into the dialysis machine. Inorganic salts and uria are removed and clean blood is pumped back into the patient's body.