The US is to hand formal control of a controversial prison to the Afghan government on Monday, despite apparent disagreements between the two sides on the fate of hundreds of inmates.