The kernel allocates a major:minor number, either statically (in drivers that do have a static allocation and haven't run out) or dynamically (in drivers that support dynamic allocation and have used up their static allotment). This number is listed in the message that the kernel sends to udev.
You can see the variables that udev sees about a device in /sys/devices/…/uevent
. For example:
$ cat /sys/devices/virtual/mem/null/uevent
MAJOR=1
MINOR=3
DEVNAME=null
DEVMODE=0666
$ cat /sys/block/sda/sda1/uevent
MAJOR=8
MINOR=1
DEVNAME=sda1
DEVTYPE=partition
The udev rules determine the name(s) and permissions of the device files. The device number comes from the kernel (it has to, since the kernel has already taken a decision and udev's job is to ensure that applications accessing the device by name will reach the number chosen by the kernel).