The problem with 'Luck' is that it is a human concept applied to the quantum workings of the universe, which itself does not care if one macroscopic system is favoured by the vagaries of chance while another is harmed by the vagaries of chance, or is also favoured, or has no net benefit or loss from its point of view.
Put more simply: Our universe simply doesn't care how many people get lucky or unlucky.
This leaves us with two possibilities:
- The universe described in the question is different to our own, and is quite probably (though not definitely) an anthropically-oriented simulation, (possibly matrix-like in which sentient beings are beings out-of-universe who are plugged into the simulation, though it does not necessarily follow that they must be plug-ins, and are not entirely simulated themselves), in which subjective luck is a limited resource,
or:
- The creators of the technology that 'transfers' 'luck' (i.e. net benefit or harm to living beings) deliberately included an unnecessary component that negatively affects non-target beings at the same time as it positively affects target beings, according to the net gain or loss inferred on targets and non-targets, based on the subjective appraisal of said gain/loss by all beings within its area of effect.
In the case of option 1, this could be an experiment on the effects of an anthropically-oriented universe as opposed to our impersonal universe.
In the case of option 2, the creators of the luck transference technology/magic must either had the mistaken assumption that luck is a universally-limited resource rather than mere localised quantum variations that could be influenced without affecting other localities, or they must have - with malice aforethought - set out to ensure that the device they created had no net subjective benefit or harm to the beings in its area of influence.
The reason for this may be simple malice, or there may be a more subtle, probably legally-oriented reason. For example: the government in the time and place that the device(s) was(were) created may have had some arcane legal requirement that equated imposition of health benefits with financial gain, and that in order to avoid that government's tax laws that would have seen the device's owners taxed according to the net benefit it bestowed, chose to have it impose no net benefit, by causing low-level harm to a large number of non-targets commensurate with the benefit gained by the low numbers of target individuals.
As to how it works - that depends on the two cases above.
In Case 1, the simulation/different universe: The luckiness or unluckiness of an individual is determined by the generation of a random number in the simulation engine. Luck transference to an individual or group may occur by having a subroutine pick better values out of a buffer of truly random data that is otherwise streamed sequentially as randomness is required, leaving the less-lucky values for everyone else.
In Case 2, our own universe or a reasonable facsimile: The world may be seeded with nanites that are able to change living beings and influence otherwise random outcomes for better or worse relative to the living beings between them. Due to the requirement that the entire system confer no net gain or loss as subjectively assessed by those living beings, they would be networked, forming a distributed intelligence, reading peoples' minds and imposing 'luckiness' or 'unluckiness' according to their/its target criteria, the entire system designed to produce no net gain or loss except over short, non-reportable periods.
How? The nanites might read an individual's intent, and assess the likelihood that the actions they were performing would lead to a subjectively positive or negative outcome, and if necessary alter those actions by something as simple as adding or subtracting a few nerve impulses here and there so that an individual's actions were unexpectedly successful or otherwise, or someone had (or didn't have) a particular worthwhile thought or idea, or they might correct or create a genetic or immunological deficiency that would lead to cancer or disease immunity.
Either way, luck transference can probably be put down to someone quite a while ago making the informed decision to make a lot of people's lives more miserable than necessary.