Theoretically it is illegal to live on a boat on Sydney Harbour or other waterways controlled by NSW Maritime. Theoretically. The law is that you can only stay on board a limited number of days per year. (I'll check the exact figure and come back to you).
Realistically it is doable. Waterways usually turn a blind eye on liveaboards if docked at a marina with decent shore facilities (showers, toilets etc ) and that liveaboards keep their boats in a slightly less than squallid condition.
Itinerant yachties are tolerated if anchored in an area that has onshore facilities. Holding tanks are of course de rigueur. Visitors anchored in areas with no onshore facilities will usually be spoken too if they stay in one place for more than a week or so.
Overall the situation is 'softly softly'. Keep a low profile, don't push the limits and don't make a complete ass of yourself then all should be cool.
Oh yes, if on a marina it is up to the marina management to decide if they would allow you to live on board.
Costs will range from AUD300.00 to AUD500.00 a month for a swing mooring, twice that and more for a marina berth depending on location and facilities. As an example we pay AUD600.00 for our old boat's berth while we are preparing her for sale. This is a marina in average condition, in a middling to upper location. Depending on location there can be a long waiting list.
“Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life.” Terry Pratchett