Well, they are certainly not interchangeable in your examples. I suggest that 'by' takes only the gerund, while 'with' takes either the gerund or the stative noun.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.