I am sorry if I sound like a broken record, but below is the simple solution to this issue:

It is a bad idea for jails to hold illegal immigrant prisoners past their prison sentence. It is better for states and cities to create laws that allow immigration agents to take custody of prisoners 72 hours before they are due to be released. The prisoners would still be prisoners regardless of who is holding them. There would be no civil rights violation of holding someone beyond the court sentence. Local jails would not have extra cost associated with late or no pickups.