Why is bail being discussed as a form of punishment by the Supreme Court

Bail cannot be withheld as a form of punishment as per Supreme Court ruling.