U.S. Laws
The reason we (Americans) end up with off-topic additions to laws is that, while the President is able to veto bills passed by Congress, he isn't able to veto only parts of them. Knowing that he won't veto a bill to provide protection for former Vice-Presidents, somebody in the Senate has tacked this on to that bill. That way, they can get it passed and signed into law without too much technical debate, which most in Congress wouldn't understand anyway.
If you're charged under this law, you'll probably just be told that you violated "US Code Section 132005, section 449a, subsection Q" or something, so the title of the law is only of interest to lawyers anyway.
"Earmarks", as mentioned earlier, usually only refers to specific spending requests tacked onto bills by individual lawmakers to benefit their states/districts (i.e. buy them votes), so this wouldn't qualify.