As long as the ruck / maul has not been set up by the attacking team without a tackler, e.g. ball carrier going straight to ground unaided by the defense and setting the ruck up.
Could well be wrong. Cooky will reveal all.
That's not a tackle. For it to be a tackle, the ball carrier must be brought to ground
by an opponent. If the ball carrier goes to ground voluntarily, then its covered by Law 14, "Ball on the ground. No tackle"
The Gain/No Gain Law is basically this.
1. Carry the ball back and kick it out,
2. Carry the ball back and pass it to a teammate who kicks it out,
3. Pass the ball back to a team mate who kicks it out,
4. Pass the ball back to a team-mate who passes the ball to another team-mate who kicks it out.
All four cases get
no gain in ground if the ball is kicked directly into touch, without touching the ground or an opponent.
In any of these cases, if the ball is then touched by an opponent, or the ball carrier is tackled (and brought to ground) and/or a ruck is formed, the no gain situation expires and the ball may then be kicked directly into touch if the defending team get the ball from the tackle or the ruck.
In Cymro's example above, even if the player is not tackled (goes to ground voluntarily), if a ruck is formed, the no gain situation expires and the ball can be kicked directly out for a gain in ground.
Here are some variations on a scenario.
1. Red wins a ruck just outside their own 22, and the scrummie throws a shocking pass that skids along the ground and misses everyone. Red 10 dives on the ball, and another Red defender picks up the ball and kicks it out 40m downfield -
pass back, no tackle so no gain in ground
2. Red wins a ruck just outside their own 22, and the scrummie throws a shocking pass that skids along the ground and misses everyone. Red 10 dives on the ball. A Blue attacker arrives and tries to pick up the ball but before he can touch it, a Red defender arrives too and binds into the Blue attacker. Ruck formed. The ball comes out of the Red side of the ruck, and a Red player picks it up and kicks it out 40m downfield -
pass back, ruck formed, gain in ground allowed.
3. Red wins a ruck just outside their own 22, and the scrummie throws a long pass back to Red 10, who fumbles the ball. A Blue attacker arrives and tackles Red 10. A Red player enters thought the gate, picks up the ball and kicks it out 40m downfield -
pass back, tackle made, gain in ground.
NOTE: Non of the above applies if a maul is formed. A maul does not negate the carry back situation.