From the beginnings of the British army until 1871, most officers bought their commissions. Soldiers could be promoted for merit or after casualties, usually in wartime (like Richard Sharpe, but generally advancement required cash. The idea behind selling commissions is that only the wealthy (gentlemen) would become officers. They who would be less likely to loot and would have a vested interest in the status quo: ie unlikely to take up arms against their own government. Also since officers could sell their commissions when then wished to retire, it created essentially a pension scheme.