Which are the advantages of using a ramjet compared to a rocket engine in an air-to-surface missile? I suppose the cost rises a lot, so why do some countries use ramjets as a way of propelling ASM missiles?
A rocket-powered missile carries both fuel and oxidiser and oxidiser is the heavier part. For example a gram of jet fuel needs almost 3.4 grams of oxygen to fully burn! Increasing the fuel load requires also increasing the power, which means even more fuel and this limits the practical range of a missile.
Ramjets are air-breathing, so they don't need to carry the oxidiser, which means the same amount of fuel gives them significantly longer range. Plus the other constituents of air, and extra air, that get pulled along and heated in the engine add to the available reaction mass, further increasing the propulsive efficiency.
Longer range means the aircraft can fire the missile further away and avoid coming into range of the defenses placed around the target, which might make difference between being able to attack a heavily defended target and not, so it is worth the expense to have some in stock.
Also note that ramjet is only more complicated, and expensive, than a solid-fuel rocket motor. Compared to liquid-fuel rocket it is simpler, because it only needs easy-to-handle kerosene while liquid-fuel rockets either need liquid oxygen, or nasty stuff like peroxide or hydrazine. It is also simpler compared to a full turbofan or turbojet (a small solid rocket booster is usually used to get it up to speed).
Simplicity of propulsion translates to cost savings, but there are tradeoffs in using a ramjet in a missile. The reason most aircraft-carried missiles do not use ramjet engines is because such a missile has to be accelerated to a sufficient speed for the engine to begin producing thrust.
"A ramjet equipped aircraft requires another type of propulsion to accelerate it to a speed at which the ramjet is capable of producing thrust. A ramjet can theoretically be started at speeds as low as 100 knots but it does not start to produce any significant thrust until the airspeed reaches approximately mach 0.5. Even at this speed, efficiency is very low and peak efficiency will not be attained until reaching supersonic speeds in the realm of mach 3."
What this means is that such a missile can only be carried by aircraft that can fly at mach 0.5 or above, or they have to be equipped with some other means of propulsion to accelerate the missile so the ramjet can start operating. It is much simpler to equip it with a rocket or turbine engine, depending on the requirements of the design.
It's a slightly odd question, as for the most part a ramjet isn't an alternative to a rocket engine for an ASM, but an alternative to a turbojet or turbofan engine.
On the whole, rockets are normally used in short-range weapons (typically on semi-ballistic trajectories), whereas cruise missiles (utilising aerodynamic lift for flight) use various types of jets for propulsion. A few older cruise missiles (particularly in the anti-ship arena) use rockets, such as the Styx/Silkworm missiles and the older Exocets.
For a long-range cruise missile ramjet propulsion provides the cost/benefit split versus other jets as you'd expect - more fuel means a larger missile, but a higher speed makes interception harder. Flying faster also makes for more difficult guidance (read expense), and the extra heat (along with possibly having to fly higher) negates some of the interception advantages. There's a distinct East-West split on whether this is worthwhile - Soviet/Russian weapons tend towards large and very fast (using ramjets), whereas Western missiles tend to be both smaller and cheaper, and avoid interception by means of stealth and increased numbers launched.
Jan Hudec’s answer here is pretty good, but the I’d add that it’s more than just oxidizer, it’s the idea with a ramjet that:
1) You can use the air from the atmosphere itself as a working mass. It’s also the same reason airliners and other airplanes don’t make use of rocket engines for propulsion. As opposed to a rocket engine which requires the vehicle to pack all the mass used to create thrust from, in a ramjet all that’s needed is the fuel which reacts with oxygen in the atmosphere to heat the air moving through the engine core. The upshot is that the aircraft has much greater range that it would with a rocket engine, which can only burn for a brief time before going into unpowered ballistic flight and quickly decelerating due to atmospheric drag.
2) Ramjets have no moving parts which make them simple, reliable and light weight as opposed to jet engines or liquid fueled rocket engines.
3) Ramjets are safer than liquid fueled rockets due to not carrying an oxidizer aboard.
4) Ramjets offer good performance at supersonic speeds ie Mach 2 to Mach 5 range, giving the missile a lot of smash or kinetic energy to the target and reducing an enemy’s ability to evade the missile.
The downside to Ramjets is that they won’t work at slower speeds. This requires another type of propulsion system like a solid fuel rocket booster to accelerate the missile up to its cruise speed before the Ramjet can light and continue the flight.
The advantage is that your air to surface missile can be supersonic and run on cheap gasoline. The Air Force BOMARC was surface to air ram jet powered, capable of speeds greater than Mach 2. They were accelerated to operational speed with simple solid fuel boosters. These could easily be converted to air to surface, launched from an aircraft travelling at sufficient speed.
But alas, surface to air missiles are much faster, and an incoming supersonic, although much faster than a slow stealth, will be detected much sooner.
However ramjets may make a comeback if they are applied to supersonic cargo or passenger aircraft. Marquardt, if they are still around, might be the ones to call.