Sugar acts as a food preservative by