You could do this with a small loop in a ban event:

on @*:ban:#:{
var %i = 1
while ($ialchan($banmask,#,%i).nick) {
kick # $ifmatch Banned by $nick
inc %i
}
}

Some networks, namely Dalnet, allow you to kick multiple users in a single kick command which you can use to your advantage in this case:

on @*:ban:#:{
var %i = 1,%k
while ($ialchan($banmask,#,%i).nick) {
%k = $addtok(%k,$ifmatch,44)
if (4 // %i) {
kick # %k Banned by $nick
%k =
}
inc %i
}
kick # $$(%k) Banned by $nick
}

The 4 in if (4 // represents the number of nicknames it will attempt to send in a kick command