It is a type of car powertrain layout. Although the term "mid-engine" can mean the engine is placed anywhere in the car such that the centre of gravity of the engine lies between the front and rear axles, it is usually used for sports cars and racing cars where the engine is behind the passenger compartment. The motive output is then sent down a shaft to a differential in the centre of the car, which in the case of an M4 layout, distributes power to both front and rear axles.
The centre differential contained within many 4 wheel drive cars is similar to the conventional differential in a 2-wheel drive car. It allows torque to be distributed to both drive axles whilst allowing them to spin at different speeds, which vastly improves the cornering of a 4-wheel drive car on surfaces with high grip such as tarmac. However, unlike the differentials on the drive axles which are configured to provide torque equally to both wheels, the centre differential is usually set to have a bias to one set of drive wheels or the other, depending on application of the car.
Some 4 wheel drive cars use a centre viscous coupling unit that will provide most power to the rear wheels unless the amount of torque being supplied to the rear wheels is in excess of the traction limits of the rear tyres, such as in a Lamborghini Murciélago. Others contain a computer that will decide how much power to distribute to any wheel at any time depending on the circumstances of each wheel. In general the M4 system is not widely used as it is suited toward sports cars and some off-road racing vehicles.
The engine is usually where the weight of a car is most concentrated so placing it between the front and rear axles gives a car a much better handling balance. Assuming the engine is behind the passenger compartment, the engine will also be pushing down on the rear wheels. Because the weight of a car is shifted toward the rear under acceleration in all cars as a rule, this further improves the amount of grip on the rear wheels, increasing the amount of torque that can be supplied to the rear wheels before wheelspin occurs. Because the engine is not in the front, the car can be designed with a minimum amount of frontal area perpendicular to the wind, greatly increasing aerodynamic efficiency.
A computer-controlled four-wheel-drive differential system allows a car to both accelerate and corner more quickly, since it can vary the amount of torque going to the front and rear wheels, and therefore vary how much the car behaves like a front- or rear-wheel-drive car. This means that through a fast corner the car is able to display more “neutral” handling - with less oversteer or understeer. This is a much more efficient means of turning and allows for faster cornering speeds as opposed to a two-wheel or conventional four-wheel-drive system. 
Some cars are designed with a rear wheel drive powertrain where the power is sent to the rear wheels. This design is cheaper than the M4 design because of the limited parts required to make the system function. Manufacturers use a unique layout to balance the weight distributed between the front and rear axels. Having a front engine layout with a rear wheel drive powertrain almost evens out the weight distributed in order to optimize performance and handling.
Most mid-engine cars, because of the size and position of the engine and transmission, compromise heavily on both passenger and boot/trunk space.
Four-wheel-drive systems tend to be quite heavy and some of the engine's power can be lost through the various differentials in the car, in addition to the frictional losses of the powertrain.
The variable handling characteristics of a four-wheel-drive car mean that when travelling round a corner at high speeds the car may enter the corner and understeer and then half-way through the corner suddenly start to oversteer.
Bugatti Veyron, the world's fastest production car at the time of its production
- "Series 8 Episode 5". Top Gear. BBC. BBC Two. 2006-06-04.
- RallyCars.com Full time 4 wheel drive turbo charged car dynamics