In the NT the theme to be developed most explicitly from Ps 40 is the passage on sacrifice, vv 7–9. The writer of the Epistle to the Hebrews develops the passage in his account of the permanent nature of the sacrifice of Christ. The words of the ancient psalm are now set in the mouth of Christ (Heb 10:5–10), though with some modification, for the writer of the Epistle employs the slightly different text of the Septuagint at this point (see note a* on v 7). In one sense, Hebrews goes beyond Ps 40; the perpetual sacrifices of the past have become obsolete in terms of the permanent sacrifice of Christ. But in another sense, the writer of the Epistle grasps the fundamental sense of the psalm and neatly reverses it. The king in the ancient kingdom had been required to offer sacrifices, but that was not all; beyond the formalities of the cult, obedience and profound spirituality were required of him, for sacrifices in and of themselves achieved nothing. In Christ, says the writer of the Epistle, there is a reversal; first, he affirms his intention to do the divine will (Heb 10:9), and that intention in turn leads back inevitably to sacrifice, but now to the sacrifice that ends all sacrifices.
PETER C. CRAIGIE AND MARVIN TATE, PSALMS 1-50, VOLUME 19: SECOND EDITION (WORD BIBLICAL COMMENTARY), 317.