You can purchase the ticket on the NJ transit train but there is sometimes a surcharge. There are 2 ticket machines in 30th street station. One by where the Septa R trains let you off and one by the Amtrak check in machine. I would suggest purchasing a ticket before hand.