Fighters will diet and train down to a weight much lower than their walking around weight right before weigh in's and then cut the water weight(dehydration basically) on the last day right before weigh in's. They only have to weigh within their weight class limit at the weigh in's the day before the fight. After the weigh in's they rehydrate their body by drinking fluids and eating back up to the weight they trained and dieted to be.
So for example lets say Thiago Alves trains down to 195, he would cut his water weight the night before the weigh in's to the welterweight limit of 170. Then after the weigh in's he rehydrate's his body back to 195.