Because of a quirk in an agreement between William Penn and the duke of York more than three centuries ago , some stretches of the Delaware River between Delaware and New Jersey belong almost entirely to Delaware .