Hi Edson,
The licenses themselves are separate but related in regards to this command. The licenses allow certain capabilities whether it be core which allows the full capabilities of OSPF, EAPS, PIM etc as opposed to a edge license which is limited in its protocol use. So in a nutshell each switch needs its own separate license and the stacking command is used to limit the license level jsut for stacking purposes. As Bill mentioned in order to be a master-capable node the license has to match.
The license you need depends on how (for lack of a better term) complicated or robust you want to make the network. You can have a "core" switch jsut do standard routing and it would not require a core license. However if you would like to add multiple VLANs (More than 4, I believe) into OSPF it requires the core license.
I hope this helps and let me know if you need clarification.