Restrictions on leave for jailed mothers are unlawful, High Court rules