libpayload uses both.
For example, line 52 defines a class "libcbfs", line 64 adds the subdir "libcbfs".And https://elixir.bootlin.com/coreboot/latest/source/payloads/libpayload/libcbf... adds its sources to the libcbfs class.
Roughly speaking: subdirs-y just makes the build system scan the Makefile in those subdirs. classes-y creates a new type of build artifact (e.g. bootblock/romstage/ramstage in coreboot, or the various libraries in libpayload), and then $classname-y collects the sources related to that artifact.
Hope this helps, Patrick