Who wrote 'Oh what a tangled web we weave when first we practice to deceive'?

Sir Walter Scott records these lines, in Canto VI, Stanza 17 of "Marmion" (1808), an epic poem about the Battle of Flodden Field in 1513.

The meaning is, basically, that lies beget more lies, and that masking lies with more lies creates an ever-more-complex arrangement of falsehoods.

(see related question)