One of Paul's friends from America was visiting and saw a female traffic warden, which were new in Britain, and commented on the "meter maids." Paul was amused with the term and wrote a song about it. He originally intended for it to be a hate song, but thought it would be more amusing if the singer was in love with her - in exchange for dismissal of the ticket.
The real meter maid?
Years after the song was released a woman named Meta Davies claimed the song was inspired by her writing a ticket for a P McCartney. When Paul came out he asked if Meta Davies was her real name, and when she replied that it was he asked if he could use it in a song. If this story is true, it is most likely that the song was already written and Paul was simply flattering her.