Question Regarding Hours

I’m just curious,

I’m a private pilot with about 150 hours TT. I know that you cannot fly for hire until you’ve obtained your commercial license, however I’m curious if a private pilot is allowed to perform ferry flights without getting paid and sharing half the cost of the flight? Just considering other ways I can build total hours while completing my instrument rating and commercial license.

Thank you!