Water moves by osmosis from a region of high water potential (dilute) to a region of low water potential (concentrated) through a partially permeable membrane.
In strong sugar solution the outside has a lower water potential than the potato cells, so water leaves the cells. The potato loses mass.
And in pure water the potato cells have a lower water potential than the outside, so water enters and the mass increases.