Matching produces a set of matching weights, one for each unit. Those who don't receive a match are given a weight of zero. In 1:1 matching without replacement, those who are matched are given a weight of 1. Things get more complicated with K:1 matching and matching with replacement. There are formulas to transform the matched set into weights. Typically this is done by assigning weights as the inverse of the number of control units matched to each treated unit. For example, if one treated unit had two control matches, the control units would each receive a weight of .5. When matching with replacement, control units that are matched more than once get a weight for each treated unit they are paired with, and then those weights are added together. For example, if a control unit was one of two control units matched with one treated unit, and the only control unit matched with another treated unit, it would get a weight of .5 + 1 = 1.5.
With these weights, you can run a weighted regression of the outcome on the treatment. Robust standard errors should be used.
In R, matchit() in the MatchIt package automatically returns matching weights when it performs a match. You can just extract those and use them in a call to svyglm() or however else you like to compute robust standard errors with weighted regressions.
MatchItapproach, matching is just a way to prune unneeded units and assign weights to others. Rosenbaum and others argue that you should retain the pairing when estimating treatment effects and use permutation or repeated measures tests. But the philosophy used in theMatchingpackage may be what you're looking for. It relies on methods described by Abadie and Imbens, which include something like what you described. See my answer here. – Noah Oct 27 '19 at 19:28