I tend to come to a screeching halt and get very, very confrontational, letting out inhuman bellowing growls while stalking angrily toward the dog. This is not the outcome they have in mind, I guess. Anyway, I chase them to their fence, porch or whatever they call their territory. They'll keep barking, but they sure don't chase me as I leave. I suppose some truly dangerous fighting dog might stand its ground once it was on its territory.
For my own amusement, I did try your general scheme once, with a couple of dogs out on a section of highway that I'd travelled enough to know they'd come out to bark. I fed them quite a few Fig Newtons. They never did get anywhere near friendly, but they barked a little uncertainly as they gulped down the cookies!