My answer is mostly based off recently reading Gerard K. O'Neill's The High Frontier, a book talking about the practicality of building self-sufficient space habitats. It was written back during the 1970's, but most of what it talks about holds up today.
Long story short, O'Neill lays out a plausible scenario where humanity can build habitats cheaply enough and quickly enough to accommodate a population growing from not only new births, but also from immigration from Earth. These habitats would be rotating spheres, rings, or cylinders built from aluminum mined on the moon, large enough to sustain a population of hundreds at the smaller end of the scale, and tens of millions at the larger end. If you've reached the point where you can do this, then there's not much of a jump to make that you would start building habitats expressly to take the criminal population from other habitats.
As for the habitats themselves, they can be made as brutal or comfortable as you like. In space, energy is cheap and plentiful, and atmospheric conditions can be maintained at whatever state you want. It would still be expensive to supply the prisoners with nice consumer goods, but there would be little reason to intentionally leave the ambient atmospheric conditions at anything other than pleasant, unless your intention is to punish the prisoners by making it too hot or too cold.
If you plan on working the prisoners, I would actually suggest having them do something other than mining. A habitat is an enclosed environment that doesn't require any special equipment to live in, but a barren rock requires giving the prisoners access to life support, ships, heavy equipment, and then letting them out to work. You could make it secure, but it would be a lot of work. I would recommend having the prisoners work as farmers. Habitats are ideal for this purpose, as growing conditions can be kept optimal at all times, and the environment can be kept free of pests. It doesn't require much in the way of heavy equipment, though it would be more efficient if the prisoners had access to such gear; and the prisoners can supply their own rations, with the rest going to pay for the additional costs associated with a prison.