In the case of a Direct Link sale, that's an instant-checkout Buy Now type of button, so the Affiliate ID is included in the link code, and they get credit for the sale that way.
For Hop Links which refer the buyer to the Merchant's own page, clicking that link sets a cookie in the buyer's browser that is good for 6 months (or whenever their browser is set to delete cookies), so any product with a Hop Link enabled that the buyer purchases from the Merchant site during that period would credit the original Affiliate.
Please see our recent forum post here for a more detailed description of the link types and their relative advantages/drawbacks:
http://www.e-junkie.com/bb/topic/2690#post7025