Tuning the giant magnetoelastic transition in Ba3BiIr2O9 and Ba3BiRu2O9