Meditation is karma (action), samadhi (or jhana) is karma vipakka (the outcome of the action of meditation).
So once again karma purifies karma!
It is too simplified, it doesn't increase our the understanding of the topic. Dhyana and samadhi is an active karma, otherwise it could not produce existence in the two higher realms. Resulting existence in the two higher realms is karma-vipaka (karma result) or karma phala (fruit of karma).
In the Twelve links action occurs in the second, eighth and ninth links (mental formation, desire and grasping). Immovable action (dhyana) can occur in these three links, thus you can take birth in the two higher realms in this lfe or in a future life: in this life
, if immovable action takes place in the second link, and in a future life
, if it takes place in the eight and ninth links.
Absence of ignorance is the condition for the ceasing of karmic formation. Absence of ignorance is Knowledge (Vidya or Prajña). It is the real cause for purifying the mass of ignorance and the mass of suffering.
Immovable action is a temporary cause for the removal of suffering, it is a temporary relief from the human realm and the three lower realms in samsara.
There is some difference in the use of terminology for dhyana, the resulting stages are sometimes called samapatti
. Usually samadhi is equal to dhyana.