From a cost standpoint the 9mm is not that much more of a savings over the .40 IMO-YMMV (I buy Walmart when it's on sale Winchester 'white-box'). I like to practice with what I carry for self defense.
There's no doubt about it .22 ammo is much cheaper than 9mm or .40. Depending on what you get in a .22 some models are 'ammo fussy' especially in semi-autos.
My Sigma .40 and my Springfield XD-45 Tactical are not ammo fussy.