Internal refrigeration with work-producing gas expansion loop