The shock you have shown is called a "coil over shock absorber". The shock which is located in the center of the spring, functions just like any other shock absorber. It will most likely have hydraulic oil with baffles. It may or may not be gas charged. The shock casing is made stronger than a regular shock, mainly to support the spring. You'll also notice the threads on the body, which makes it adjustable. You can vary the ride height of your vehicle by screwing the spring perch up or down on the shock body.
The real reason for this type of shock is to eliminate the stock spring on a vehicle. This makes for a more compact fit within the footprint of what would normally just be the shock. It might allow the owner to put a different type of axle under the vehicle or allow space for wider tires. It might also just be used for an aesthetic look the owner is going for.