J.P. Morgan Chase & Co. is in talks to sell its oil-supply agreement with a major Philadelphia refinery to Bank of America Corp., according to people familiar with the matter.

J.P. Morgan has a deal with Philadelphia Energy Solutions under which it supplies the refinery with crude oil and credit, and receives refined fuel products in return that it can trade. The refinery is one of the largest in the country, processing 330,000 barrels of crude a day, and is owned and operated by a joint venture between Sunoco Inc. and...